Initial Commit

This commit is contained in:
2022-10-07 00:22:46 -03:00
commit bdcf6d3e1c
465 changed files with 15466 additions and 0 deletions

View File

@ -0,0 +1,62 @@
/**
@author Isaac Shoebottom (3429069)
**/
public class ActivityTab {
//Initialize name in class
private final String name;
//Initialize room number in class
private final int roomNumber;
//Initialize amount owed
private double amountOwed;
/**Make the class to hold the information for the name, room number and amount owed
* @param nameIn The name of the person to be put on file
* @param roomNumberIn The room number the person on file is to be put in
* @param amountOwedIn The amount owed when initializing the class (Always 0.00 as of now, can be changed for modularity)
*/
public ActivityTab(String nameIn, int roomNumberIn, double amountOwedIn){
this.name = nameIn;
this.roomNumber = roomNumberIn;
this.amountOwed = amountOwedIn;
}
/**Getter method to get the amount owed
* @return amountOwed The amount of money the person owes at the time called
*/
public double getAmountOwed() {
return this.amountOwed;
}
/**
* Getter method to get the name of person on tab
* @return name The name of the person on file
*/
public String getName(){
return this.name;
}
/**Getter to get the room number of person on tab
* @return roomNumber The room number of the person on file
*/
public int getRoomNumber(){
return this.roomNumber;
}
/**Accumulator to add the amount that the person owes to their total
* @param activityPrice The price of the activity
*/
public void addAmountOwed(double activityPrice){
this.amountOwed = this.amountOwed + activityPrice;
}
/**Calculate the tip with the percentage they wish to use
* @param percentageAmount The percentage amount (e.g. 18% = 18)
* @return A double representing the tip the person will pay
*/
public double processTip(double percentageAmount){
return (this.amountOwed * (percentageAmount/100));
}
}

View File

@ -0,0 +1,21 @@
dawnsTab:
Name: Dawn MacIsaac
Room Number: 42
Amount Owed: $5.85
luigisTab:
Name: Luigi Benedicenti
Room Number: 112
Amount Owed: $20.25
nataliesTab:
Name: Natalie Webber
Room Number: 214
Amount Owed: $15.25
leahsTab:
Name: Leah Bidlake
Room Number: 78
Amount Owed: $13.0
Leah Bidlake leaves a $2.34 tip
Natalie Webber leaves a $1.95 tip
Dawn MacIsaac leaves a $1.17 tip
Luigi Benedicenti leaves a $4.05 tip

View File

@ -0,0 +1,56 @@
/**
@author Isaac Shoebottom (3429069)
**/
public class ComputerScienceRetreat {
public static void main(String[] args){
runRetreat();
}
private static void runRetreat(){
ActivityTab dawnsTab = new ActivityTab("Dawn MacIsaac", 42, 0.00);
dawnsTab.addAmountOwed(3.25);
ActivityTab luigisTab = new ActivityTab("Luigi Benedicenti", 112, 0.00);
luigisTab.addAmountOwed(8.50);
ActivityTab nataliesTab = new ActivityTab("Natalie Webber", 214, 0.00);
nataliesTab.addAmountOwed(4.00);
nataliesTab.addAmountOwed(6.00);
ActivityTab leahsTab = new ActivityTab("Leah Bidlake", 78, 0.00);
leahsTab.addAmountOwed(7.75);
nataliesTab.addAmountOwed(5.25);
leahsTab.addAmountOwed(5.25);
luigisTab.addAmountOwed(11.75);
dawnsTab.addAmountOwed(2.60);
System.out.println("dawnsTab:" +
"\n Name: " + dawnsTab.getName() +
"\n Room Number: " + dawnsTab.getRoomNumber() +
"\n Amount Owed: $" + dawnsTab.getAmountOwed());
System.out.println("luigisTab:" +
"\n Name: " + luigisTab.getName() +
"\n Room Number: " + luigisTab.getRoomNumber() +
"\n Amount Owed: $" + luigisTab.getAmountOwed());
System.out.println("nataliesTab:" +
"\n Name: " + nataliesTab.getName() +
"\n Room Number: " + nataliesTab.getRoomNumber() +
"\n Amount Owed: $" + nataliesTab.getAmountOwed());
System.out.println("leahsTab:" +
"\n Name: " + leahsTab.getName() +
"\n Room Number: " + leahsTab.getRoomNumber() +
"\n Amount Owed: $" + leahsTab.getAmountOwed());
System.out.print("\n");
System.out.println(leahsTab.getName() +" leaves a $" + leahsTab.processTip(18) + " tip");
System.out.println(nataliesTab.getName() + " leaves a $" + leahsTab.processTip(15) + " tip");
System.out.println(dawnsTab.getName() + " leaves a $" + dawnsTab.processTip(20) + " tip");
System.out.println(luigisTab.getName() + " leaves a $" + luigisTab.processTip(20) + " tip");
}
}