Commit f56b7608 authored by Arsam Ali's avatar Arsam Ali

Initial commit

parents
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="practice" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="temurin-1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>practice</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
\ No newline at end of file
package org.example;
import java.util.Scanner;
public class CalculatingEnergy {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter the amount of water in kilograms: ");
double water = input.nextDouble();
System.out.print("Enter the initial temperature: ");
double initialTemperature = input.nextDouble();
System.out.print("Enter the final temperature: ");
double finalTemperature = input.nextDouble();
final double HEAT_OF_WATER = 4184;
//Q=m⋅c⋅ΔT
double energy = water * (finalTemperature - initialTemperature) * HEAT_OF_WATER;
System.out.println("The energy needed is " + energy );
}
}
package org.example;
import java.util.Scanner;
public class CelsiusToFahrenheit {
public static void
main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a degree in Celsius: ");
double celsius = input.nextDouble();
// Fahrenheit=(5/9 X Celsius)+32
double fahrenheit = (9.0 / 5) * celsius + 32;
System.out.println(celsius + " Celsius is " + fahrenheit + " Fahrenheit");
}
}
package org.example;
import java.util.Scanner;
public class FindBMI {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter weight in pounds: ");
double weightInPounds = input.nextDouble();
System.out.print("Enter height in inches: ");
double heightInInches = input.nextDouble();
// Convert pounds to kilograms
double weightInKilograms = weightInPounds * 0.45359237;
// Convert inches to meters
double heightInMeters = heightInInches * 0.0254;
// Calculate BMI
double bmi = weightInKilograms / (heightInMeters * heightInMeters);
System.out.println("BMI is " + bmi);
}
}
package org.example;
import java.util.Scanner;
public class FutureDay {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter today's day (0 for Sunday, 1 for Monday, ..., 6 for Saturday): ");
int today = input.nextInt();
System.out.print("Enter the number of days elapsed since today: ");
int daysElapsed = input.nextInt();
int futureDay = (today + daysElapsed) % 7;
String[] daysOfWeek = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
System.out.println("Today is " + daysOfWeek[today] + " and the future day is " + daysOfWeek[futureDay]);
}
}
package org.example;
public class JavaDiagram {
public static void main(String[] args) {
String[] rows = {
" J A V V A",
" J A. A V. V A. A",
"J J AAAAA V V AAAAA",
"J A A V A A"
};
for (String row : rows) {
for (char ch : row.toCharArray()) {
System.out.print(ch + " ");
}
System.out.println();
}
}
}
package org.example;
import java.util.Scanner;
public class MinutesToYears {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of minutes: ");
long minutes = input.nextLong();
final int MINUTES_IN_YEAR = 365 * 24 * 60;
final int MINUTES_IN_DAY = 24 * 60;
int years = (int) (minutes / MINUTES_IN_DAY);
int days = (int) ((minutes % MINUTES_IN_YEAR) / MINUTES_IN_DAY);
System.out.println(minutes + " minutes is approximately " + years + " years and " + days + " days");
}
}
package org.example;
import java.util.Random;
public class MonthIntoEnglish {
public static void main(String[] args) {
// String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
//
//
// Random random = new Random();
// int monthNumber = random.nextInt(12) + 1;
//
//
// String monthName =
}
}
package org.example;
public class PopulationOfUs {
public static void main(String[] args) {
final int SECONDS_PER_DAY = 24 * 60 * 60;
final int DAYS_PER_YEAR = 365;
final double BIRTHS_PER_SECOND = 1.0 / 7;
final double DEATHS_PER_SECOND = 1.0 / 13;
final double IMMIGRANTS_PER_SECOND = 1.0 / 45;
long currentPopulation = 312032486;
// Population Change Per Year=(Births Per Second−Deaths Per Second+Immigrants Per Second)×Seconds Per Day×Days Per Year
double populationChangePerYear = (BIRTHS_PER_SECOND - DEATHS_PER_SECOND + IMMIGRANTS_PER_SECOND) * SECONDS_PER_DAY * DAYS_PER_YEAR;
for (int year = 1; year <= 5; year++) {
long newPopulation = (long) (currentPopulation + populationChangePerYear * year);
System.out.println("Year " + year + ": " + newPopulation);
}
}
}
package org.example;
import java.util.Scanner;
public class RevisedBMI {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter weight in pounds: ");
double weightInPounds = input.nextDouble();
System.out.print("Enter feet: ");
int feet = input.nextInt();
System.out.print("Enter inches: ");
int inches = input.nextInt();
// Height in Meters=(Feet×0.3048)+(Inches×0.0254)
double heightInMeters = (feet * 12 + inches) * 0.0254;
// Calculate BMI & The constant 0.45359237 is the conversion factor since 1 pound is approximately equal to 0.45359237 kilograms
double bmi = weightInPounds * 0.45359237 / (heightInMeters * heightInMeters);
String interpretation = null;
if (bmi < 18.5) {
interpretation = "Underweight";
} else if (bmi < 25) {
interpretation = "Normal";
} else if (bmi < 30) {
interpretation = "Overweight";
} else {
interpretation = "Obese";
}
System.out.println("BMI is " + bmi);
System.out.println("Interpretation: " + interpretation);
}
}
package org.example;
import java.util.Scanner;
public class SortThreeIntegers {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter three integers: ");
int num1 = input.nextInt();
int num2 = input.nextInt();
int num3 = input.nextInt();
int temp;
if (num1 > num2) {
temp = num1;
num1 = num2;
num2 = temp;
}
if (num1 > num3) {
temp = num1;
num1 = num3;
num3 = temp;
}
if (num2 > num3) {
temp = num2;
num2 = num3;
num3 = temp;
}
System.out.println("Integers in non-decreasing order: " + num1 + ", " + num2 + ", " + num3);
}
}
package org.example;
public class SpeedMeter {
public static void main(String[] args) {
// Declare variables
double kilometers = 14;
double minutes = 45;
double seconds = 30;
// Convert time to hours Formula : Hours+(//60 / Minutes )+(//3600//Seconds)
double hours = minutes / 60 + seconds / 3600;
// Convert kilometers to miles
double miles = kilometers / 1.6;
// Calculate average speed in miles per hour
double averageSpeed = miles / hours;
// Display the result
System.out.println("The average speed is: " + averageSpeed + " miles per hour");
}
}
package org.example;
import java.util.Scanner;
public class SumTheDigits {
public static void
main(String[] args)
{
// Scanner input = new Scanner(System.in);
//
// System.out.print("Enter a number between 0 and 1000: ");
// int number = input.nextInt();
//
// int sumOfDigits = 0;
// while (number > 0) {
// int
// }
}
}
package org.example;
public class TableofAndNumeric {
public static void main(String[] args) {
System.out.println("a\ta^2\ta^3");
for (int a = 1; a <= 4; a++) {
int a_squared = a * a;
int a_cubed = a * a * a;
System.out.println(a + "\t" + a_squared + "\t" + a_cubed);
}
}
}
package org.example;
import java.util.Scanner;
public class TriangleArea {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter three points for a triangle: ");
double x1 = input.nextDouble();
double y1 = input.nextDouble();
double x2 = input.nextDouble();
double y2 = input.nextDouble();
double x3 = input.nextDouble();
double y3 = input.nextDouble();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment