Question
//-----------------------------------------------tip03.java-------------------------------------------------------------------------------------------------------> package tip03; public class Calculator { public double tax = .05; public double tip = .15; public void findTotal(double price){ double total = price*(1+tax+tip);
//-----------------------------------------------tip03.java------------------------------------------------------------------------------------------------------->
package tip03;
public class Calculator { public double tax = .05; public double tip = .15; public void findTotal(double price){ double total = price*(1+tax+tip); System.out.println("$" +total);
} }
--------------------------------------------------------------------------------------------------------------------------- package tip03;
public class CalculatorTest { public static void main(String[] args) { Calculator calc = new Calculator(); //Use the Calculator object and arguments supplied to findTotal() //to print the total for each person
/*This is what everyone owes before tax and tip: Person 1: $10 Person 2: $12 Person 3: $9 Person 4: $8 Person 5: $7 Person 6: $15 (Alex) Person 7: $11 Person 8: $30 */ } }
From the main method: -Use a Calculator object instance and supply arguments to findTotal () to print the total for each person. Hint: Observe the findTotal() method in the Calculator class to figure out how many arguments this method acceptsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started