Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write two methods to calculate the tip for a meal eaten at a restaurant. One method has been partially provided for you. A server
Write two methods to calculate the tip for a meal eaten at a restaurant. One method has been partially provided for you. A server for an individual table at a restaurant is usually tipped between 15 and 20% of the cost of the meal. However, some restaurants don't leave the amount of the tip up to the customer and charge a fixed percentage of the meal. First, complete the calcTip method shown below that is based on the cost of the meal and percent of the customer's choice. Then, write a complete overloaded method called calcTip, which calculates the tip at the rate of 17.5%. //post condition: returns the amount of the tip public double calcTip (double percent, double mealCost) { } //complete the code for the first method here //second method to be written here. Question 4 (Essay Worth 6 points) Consider the following statement: double time = someObject.convertToSeconds (11.5) Write a partial class that shows a class constant and an instance method. Write an instance method that converts minutes to seconds using a class constant representing the number of seconds in one minute. The value passed to the method represents the amount of time in minutes. Paragraph AIA A A V 52 V 165 Tx B I SU X X PA HTML i bh C Question 3 (Essay Worth 6 points) Write a class method called subtract These that will accept two integer values and calculate and return their difference. 3 Add Audio V AIA A V Paragraph Add Video A V T BISU X X 2. 66 A HTML := = = EEEV G F Question 2 (Essay Worth 6 points) Consider the following segment of code: SomeClass someObject1 = new SomeClass (23); SomeClass someObject2 = new SomeClass (98.6); SomeClass someObject3 = new SomeClass (23, 98.6); Write the SomeClass class based on the statements above. Include any instance variables and the complete constructors, including the assignment of variables. (Other code exists in SomeClass but will not be written at this time.) ave Paragraph LAIA A V A V I BI & U X X 52 66 V HTML := !! - E v c C
Step by Step Solution
★★★★★
3.43 Rating (169 Votes )
There are 3 Steps involved in it
Step: 1
1 Calculate Tip Methods Here are two methods to calculate ...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