diff --git a/src/CylinderCalculator.java b/src/CylinderCalculator.java new file mode 100644 index 0000000..896e818 --- /dev/null +++ b/src/CylinderCalculator.java @@ -0,0 +1,23 @@ +import java.util.Scanner; + +public class CylinderCalculator { + public CylinderCalculator() {} + + public void display() { + Scanner scanner = new Scanner(System.in); + System.out.print("Height of the cylinder:"); + int height = scanner.nextInt(); + System.out.print("Radius of the cylinder:"); + int radius = scanner.nextInt(); + + System.out.printf("The surface area of the cylinder is: %.1f and the volume is %.1f", + Math.TAU*radius*height + Math.TAU*radius*2, + Math.PI * radius * 2 * height + ); + } + + public static void main(String[] args) { + CylinderCalculator r = new CylinderCalculator(); + r.display(); + } +} diff --git a/src/EmployeeEarnings.java b/src/EmployeeEarnings.java deleted file mode 100644 index 41087db..0000000 --- a/src/EmployeeEarnings.java +++ /dev/null @@ -1,33 +0,0 @@ -public class EmployeeEarnings { - EmployeeEarnings() { - } - - public void top() { - System.out.printf("%50s %n%n","MWPSB Employee Earnings"); - System.out.printf("%-20s %-20s %-20s %-20s %n %n","Employee","Hourly Rate","Hours per week","Gross Monthly Salary"); - } - - public void data() { - String name1 = "Akane Tsunemori"; - String name2 = "Shinya Kogami"; - String name3 = "Shusei Kagari"; - - double rate1 = 31.5; - double rate2 = 18.25; - double rate3 = 22; - - int hours1 = 45; - int hours2 = 24; - int hours3 = 37; - - System.out.printf("%-20s $%-20.2f%-20d $%-20.2f %n", name1, rate1, hours1, rate1*hours1*4); - System.out.printf("%-20s $%-20.2f%-20d $%-20.2f %n", name2, rate2, hours2, rate2*hours2*4); - System.out.printf("%-20s $%-20.2f%-20d $%-20.2f %n", name3, rate3, hours3, rate3*hours3*4); - } - - public static void main(String[] args) { - EmployeeEarnings chart = new EmployeeEarnings(); - chart.top(); - chart.data(); - } -} \ No newline at end of file diff --git a/src/Lesson.java b/src/Lesson.java new file mode 100644 index 0000000..cf2bf46 --- /dev/null +++ b/src/Lesson.java @@ -0,0 +1,18 @@ +import hsa.Console; + +public class Lesson { + Console c; + + public Lesson() { + c = new Console(24); + } + + public void display() { + c.print(Math.pow(3, 2)); + } + + public static void main(String[] args) { + Lesson l = new Lesson(); + l.display(); + } +} \ No newline at end of file diff --git a/src/MyText.java b/src/MyText.java deleted file mode 100644 index 74b126f..0000000 --- a/src/MyText.java +++ /dev/null @@ -1,31 +0,0 @@ -// Ian An -// Oct 15 2026 -// User Input Assignment - -import java.util.Scanner; - -public class MyText { - public static void output() { - Scanner s = new Scanner (System.in); - - String name; - String lastName; - int grade; - - System.out.println("What is your first name?"); - name = s.nextLine(); - System.out.println("Hello "+name); - - System.out.println("What is your last name"); - lastName = s.nextLine(); - System.out.println("Hello "+lastName); - - System.out.println("What is your grade?"); - grade = s.nextInt(); - System.out.printf("So, %s %s, are you really in grade %d?",name,lastName,grade); - } - - public static void main(String[] args) { - output(); - } -} diff --git a/src/NumberRounder.java b/src/NumberRounder.java new file mode 100644 index 0000000..b26191a --- /dev/null +++ b/src/NumberRounder.java @@ -0,0 +1,20 @@ +import java.util.Scanner; + +public class NumberRounder { + public NumberRounder() {} + + public void display() { + Scanner scanner = new Scanner(System.in); + System.out.print("The number you want to round:"); + double Number = scanner.nextDouble(); + System.out.print("Round to the nearest 1, 10, 100, 1000:"); + int round = scanner.nextInt(); + + System.out.printf("The rounded number is: %d", (int) (Number + 5) / round * round); + } + + public static void main(String[] args) { + NumberRounder r = new NumberRounder(); + r.display(); + } +} diff --git a/src/PizzaBurner.java b/src/PizzaBurner.java new file mode 100644 index 0000000..935509f --- /dev/null +++ b/src/PizzaBurner.java @@ -0,0 +1,29 @@ +import java.util.Scanner; + +public class PizzaBurner { + public PizzaBurner() {} + + public void display() { + Scanner scanner = new Scanner(System.in); + System.out.print("Enter the number of pizza slices: "); + int slices = scanner.nextInt(); + + double caloriesPerSlice = 355.0; + double burnRatePerHour = 550.0; + + double totalCalories = slices * caloriesPerSlice; + double totalHours = totalCalories / burnRatePerHour; + + System.out.printf("Hours to burn off: %.2f %n", totalHours); + + int totalMinutes = (int) Math.round(totalHours * 60); + int hours = totalMinutes / 60; + int minutes = totalMinutes % 60; + System.out.printf("That is around %d hours and %d minutes",hours,minutes); + } + + public static void main(String[] args) { + PizzaBurner p = new PizzaBurner(); + p.display(); + } +} \ No newline at end of file diff --git a/src/RectangleArea.java b/src/RectangleArea.java new file mode 100644 index 0000000..1be6497 --- /dev/null +++ b/src/RectangleArea.java @@ -0,0 +1,20 @@ +import java.util.Scanner; + +public class RectangleArea { + public RectangleArea() {} + + public void display() { + Scanner scanner = new Scanner(System.in); + System.out.print("Length of the rectangle:"); + int length = scanner.nextInt(); + System.out.print("Width of the rectangle:"); + int width = scanner.nextInt(); + + System.out.printf("The area of the rectangle is: %d", length*width); + } + + public static void main(String[] args) { + RectangleArea r = new RectangleArea(); + r.display(); + } +} diff --git a/src/VariablesAssignmentB.java b/src/VariablesAssignmentB.java deleted file mode 100644 index fcd511a..0000000 --- a/src/VariablesAssignmentB.java +++ /dev/null @@ -1,29 +0,0 @@ -public class VariablesAssignmentB { - VariablesAssignmentB() { - - } - - public void Title() { - System.out.println("Name Program"); - } - - public void name1(String first, String last) { - System.out.printf("%s %s %n",first.toLowerCase(), last.toUpperCase()); - } - - public void name2(String lastName) { - for (int i = 0; i < lastName.length(); i++) { - System.out.println(lastName.charAt(i)); - } - } - - public static void main(String[] args) { - String firstName = "Ian"; - String lastName = "An"; - - VariablesAssignmentB x = new VariablesAssignmentB(); - x.Title(); - x.name1(firstName, lastName); - x.name2(lastName); - } -} diff --git a/src/docs/Ian An - Variables review.pdf b/src/docs/Ian An - Variables review.pdf new file mode 100644 index 0000000..6b8fd2b Binary files /dev/null and b/src/docs/Ian An - Variables review.pdf differ