From 27dab22a7af863dde5c0e9cec2cdae4dee814a9a Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 19 Sep 2025 23:25:58 -0700 Subject: [PATCH] week 4 DONE SON --- dropbox06/bin/dropbox06/Trip.class | Bin 1295 -> 1295 bytes dropbox06/bin/dropbox06/TripTest.class | Bin 1025 -> 1025 bytes dropbox07/bin/dropbox07/RetailTax.class | Bin 1300 -> 1300 bytes dropbox07/bin/dropbox07/TaxTest.class | Bin 1027 -> 1027 bytes dropbox10/.classpath | 10 +++ dropbox10/.project | 17 ++++ .../org.eclipse.core.resources.prefs | 2 + dropbox10/dropbox10/.gitignore | 3 + dropbox10/dropbox10/Student.java | 58 ++++++++++++++ dropbox10/dropbox10/StudentTest.java | 51 ++++++++++++ dropbox11/.classpath | 10 +++ dropbox11/.project | 17 ++++ .../org.eclipse.core.resources.prefs | 2 + dropbox11/dropbox11/.gitignore | 2 + dropbox11/dropbox11/Employee.java | 73 ++++++++++++++++++ dropbox11/dropbox11/Employee_Test.java | 51 ++++++++++++ 16 files changed, 296 insertions(+) create mode 100644 dropbox10/.classpath create mode 100644 dropbox10/.project create mode 100644 dropbox10/.settings/org.eclipse.core.resources.prefs create mode 100644 dropbox10/dropbox10/.gitignore create mode 100644 dropbox10/dropbox10/Student.java create mode 100644 dropbox10/dropbox10/StudentTest.java create mode 100644 dropbox11/.classpath create mode 100644 dropbox11/.project create mode 100644 dropbox11/.settings/org.eclipse.core.resources.prefs create mode 100644 dropbox11/dropbox11/.gitignore create mode 100644 dropbox11/dropbox11/Employee.java create mode 100644 dropbox11/dropbox11/Employee_Test.java diff --git a/dropbox06/bin/dropbox06/Trip.class b/dropbox06/bin/dropbox06/Trip.class index 6b30b8a8ec41811c4237966da622f621bc63c05e..82ab6dacdc36bd35443cb9034e2640cfa96473aa 100644 GIT binary patch delta 89 zcmeC@>gU?&lhc^pS!IDNxyhTD19%k}SQr!;I2n`} s_!yKY^Rq;9sxdGzs59^|XiP3-$>!B#;9xLdP+`zx&|ol}{E|ft01e;|bN~PV delta 89 zcmeC@>gU?vpN;9yW?P+?GJ&|pxT{E|ft0PnI6xc~qF diff --git a/dropbox06/bin/dropbox06/TripTest.class b/dropbox06/bin/dropbox06/TripTest.class index 6f782bcb6d82919c95c31e4bdae1256f8b6de85e..688fc859e9c950669518245bb6e20413bdab6c02 100644 GIT binary patch delta 59 zcmZqVXyn)+!OX}vS(3S0Q-Fb+L5P8uL6|{+L6kv)L5x9`L7YJq$kJwzVlZcrVXy~^ MI5Wsi-plL)0ODx}Jpcdz delta 59 zcmZqVXyn)+!OX}!S(3S0la+y+ft`VufrCMSfr~)`$dhH@VNeB%XfyCLm@^16*fR(* MI5P-O-plL)0Mus&xc~qF diff --git a/dropbox07/bin/dropbox07/RetailTax.class b/dropbox07/bin/dropbox07/RetailTax.class index cc79d4a4981cc860d94bc6b244fc720e5643680a..d28662bb6bd9517c1b9f360cf3a28e213e1848ad 100644 GIT binary patch delta 93 zcmbQjHHB-#9VSMR$#V;ABu{ v;A2pk%*v9&tIoj0pur%(pvfT4pf$OSC7aiPfrG(_L50BpC~iFY9g7+OI+G8z delta 93 zcmbQjHHB-#9VSN3$#?8Q-Fb+L5P8uL6|{+L6kv)L5x9`L7YJq$kJwzVlZcrVXy~^ MI5Wsi-p}j;0OTbHM*si- delta 59 zcmZqXXy(`;#mvY&S(>?8la+y+ft`VufrCMSfr~)`$dhH@VNeB%XfyCLm@^16*fR(* MI5P-O-p}j;0M;W0!vFvP diff --git a/dropbox10/.classpath b/dropbox10/.classpath new file mode 100644 index 0000000..64c0023 --- /dev/null +++ b/dropbox10/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dropbox10/.project b/dropbox10/.project new file mode 100644 index 0000000..2eedf9b --- /dev/null +++ b/dropbox10/.project @@ -0,0 +1,17 @@ + + + dropbox10 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/dropbox10/.settings/org.eclipse.core.resources.prefs b/dropbox10/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/dropbox10/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dropbox10/dropbox10/.gitignore b/dropbox10/dropbox10/.gitignore new file mode 100644 index 0000000..249277c --- /dev/null +++ b/dropbox10/dropbox10/.gitignore @@ -0,0 +1,3 @@ +/Student.class +/StudentTest.class +/studenttest.class diff --git a/dropbox10/dropbox10/Student.java b/dropbox10/dropbox10/Student.java new file mode 100644 index 0000000..3225cdf --- /dev/null +++ b/dropbox10/dropbox10/Student.java @@ -0,0 +1,58 @@ +/** + + * Assignment 10 + + * Course: CISS238 + + * Student: Scott Steely + + * Date: Sep 19, 2025 + + */ +package dropbox10; +public class Student { + // fields + private String name; + private int score; + private static int bonus; + private static int numberOfStudents; + // accessors + public String getName() { + return name; + } + public int getScore() { + return score; + } + public int getBonus() { + return bonus; + } + public int getNumberOfStudents() { + return numberOfStudents; + } + // mutators + public void setName(String name) { + this.name = name; + } + public void setScore(int score) { + this.score = score; + } + public void setBonus(int bonus) { + Student.bonus = bonus; + } + // constructor + public Student(String name, int score) { + this.name = name; + this.score = score; + numberOfStudents++; + } + // toString + @Override + public String toString() { + String str; + str = String.format("Name: %s%nScore: %d%nCurved score: %d%n" + + "Total student: %d%n", + getName(), getScore(), getScore()+getBonus(), + getNumberOfStudents()); + return str; + } +} diff --git a/dropbox10/dropbox10/StudentTest.java b/dropbox10/dropbox10/StudentTest.java new file mode 100644 index 0000000..9240976 --- /dev/null +++ b/dropbox10/dropbox10/StudentTest.java @@ -0,0 +1,51 @@ +/** + + * Assignment 10 + + * Course: CISS238 + + * Student: Scott Steely + + * Date: Sep 19, 2025 + + */ +package dropbox10; +import java.util.Scanner; +public class StudentTest { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + // variables + int numberofstudents = 0; + String name; + int score; + int bonus; + // prompt user for number of students + System.out.println("enter number of students: "); + numberofstudents = input.nextInt(); + // create an array + Student[] students = new Student[numberofstudents]; + // use a loop for student data + for(int i = 0 ; i < students.length; i++) { + // remove the enter key when the user enters the number above + input.nextLine(); + System.out.println("enter student " + (i+1) + "'s name: "); + name = input.nextLine(); + System.out.println("enter student " + (i+1) + "'s score: "); + score = input.nextInt(); + // create the student + Student s = new Student(name, score); + // add the student to the array + students[i] =s; + } + // prompt for bonus if any + System.out.println("enter bonus: "); + bonus = input.nextInt(); + // set bonus for just one student + students[0].setBonus(bonus); + // display by using a shorthand for loop + for(Student s: students) { + System.out.println(s); + } + input.close(); + } +} diff --git a/dropbox11/.classpath b/dropbox11/.classpath new file mode 100644 index 0000000..64c0023 --- /dev/null +++ b/dropbox11/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dropbox11/.project b/dropbox11/.project new file mode 100644 index 0000000..3e0440f --- /dev/null +++ b/dropbox11/.project @@ -0,0 +1,17 @@ + + + dropbox11 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/dropbox11/.settings/org.eclipse.core.resources.prefs b/dropbox11/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/dropbox11/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/dropbox11/dropbox11/.gitignore b/dropbox11/dropbox11/.gitignore new file mode 100644 index 0000000..19793c6 --- /dev/null +++ b/dropbox11/dropbox11/.gitignore @@ -0,0 +1,2 @@ +/Employee.class +/Employee_Test.class diff --git a/dropbox11/dropbox11/Employee.java b/dropbox11/dropbox11/Employee.java new file mode 100644 index 0000000..4e0710e --- /dev/null +++ b/dropbox11/dropbox11/Employee.java @@ -0,0 +1,73 @@ +/** + + * Assignment 11 + + * Course: CISS238 + + * Student: Scott Steely + + * Date: Sep 19, 2025 + + */ +package dropbox11; +public class Employee{ + // fields + private String name; + private int hours_worked; + private float pay_rate; + private static float overtime_mult; + private static int numberOfEmployees; + // accessors + public String getName() { + return name; + } + public int getHours_Worked() { + return hours_worked; + } + public float getPay_Rate() { + return pay_rate; + } + public float getOvertime_Mult() { + return overtime_mult; + } + // mutators + public void setName(String name) { + this.name = name; + } + public void setHours_Worked(int hours_worked) { + this.hours_worked = hours_worked; + } + public void setPay_Rate(float pay_rate) { + this.pay_rate = pay_rate; + } + public void setOvertime_Mult(float overtime_mult) { + Employee.overtime_mult = overtime_mult; + } + // constructor + public Employee(String name, int hours_worked, float pay_rate, float overtime_mult) { + this.name = name; + this.hours_worked = hours_worked; + Employee.overtime_mult = overtime_mult; + this.pay_rate = pay_rate; + numberOfEmployees++; + } + // method + public float getTake_Home_Pay() { + float Take_Home_Pay = (float) 0.00; + if (getHours_Worked() < 40) { + Take_Home_Pay = (getPay_Rate() * getHours_Worked()); + } + else { + Take_Home_Pay = (getPay_Rate() * 40) + ( (getHours_Worked() - 40 ) * (getPay_Rate() * getOvertime_Mult())); + } + return Take_Home_Pay; + } + + // toString + @Override + public String toString() { + String str; + str = String.format("Name: %s%nTake home pay:%s%n", getName(), getTake_Home_Pay()); + return str; + } +} diff --git a/dropbox11/dropbox11/Employee_Test.java b/dropbox11/dropbox11/Employee_Test.java new file mode 100644 index 0000000..fa29591 --- /dev/null +++ b/dropbox11/dropbox11/Employee_Test.java @@ -0,0 +1,51 @@ +/** + + * Assignment 11 + + * Course: CISS238 + + * Student: Scott Steely + + * Date: Sep 19, 2025 + + */ +package dropbox11; +import java.util.Scanner; +// public class EmployeeTest +public class Employee_Test { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + // variables + String name; + int hours_worked; + float pay_rate; + float overtime_mult; + int numberOfEmployees; + // prompt for ot bonus + System.out.println("enter all employee pay overtime multiplier: "); + overtime_mult = input.nextFloat(); + System.out.println("enter total employees "); + numberOfEmployees = input.nextInt(); + // create an array + Employee[] employee = new Employee[numberOfEmployees]; + // loop to fill the array + for(int i = 0 ; i < employee.length; i++) { + // remove the enter key when the user enters the number above + input.nextLine(); + System.out.println("enter employee name: "); + name = input.nextLine(); + System.out.println("enter hours worked: "); + hours_worked = input.nextInt(); + System.out.println("enter pay rate: "); + pay_rate = input.nextInt(); + // create the employee + Employee s = new Employee(name, hours_worked, pay_rate, overtime_mult); + // add employee to the array + employee[i] =s; + } + for(Employee s: employee) { + System.out.println(s); + } + input.close(); + } +}