Please create a code that follows the directions below exactly, and have the output look just like the one in the picture provided. If possible, please refrain from using switch statements in the code.
Insturctions:
This assignment will assess your understanding of void and value returning static methods.
Your cousin owns an automotive maintenance shop that performs routine maintenance on cars. He has asked you to write a program that will provide a list of services (and their respective prices) to users and allow them to choose any, or all, services they would like and display the final price, including a 28% labor charge, a 9% markup if the car is an import, and an 8% sales tax.
Task
To accomplish the above, do the following:
- Write the two methods outlined below.
- Test your program and screenshot your successful test.
carMaintenance method
This method should accept the make of the car as a parameter (e.g., BMW, Ford, Ferrari, etc.). It should display the services and their prices as follows:
Services: Oil Change, Tune up, Brake Job, Transmission Service, respectively: 59.99, 111.99, 189.99, 149.99
These should be stored in parallel arrays. Ask the user to select a service from the list presented for his . Allow the user to request as many services as he wants. Use an accumulator to total the price for all services requested. This method should return the total price to main. Do not call the calcFinalPrice method inside of this method – the point here is for you to write a method that returns a value.
calcFinalPrice method
This method should accept, as a parameter, the total price that was passed to main from the carMaintenance method and whether or not the car is an import. This method should add 28% to the price for labor. Then, take on 9% if the car is an import. Then an 8% sales tax. Finally, the method should output the final price. Do not return the final price here, simply print from this method.
To test your methods in main, Ask the user for the appropriate information needed to pass to your methods (hint: you will only need to ask for 2 things). Invoke (call) each method, passing the appropriate information.
Hints
- Before invoking (calling) your methods consider asking the user for both the make and if the car is an import. Use an if statement to turn the yes or no response into a boolean.
- Adding 28% to the price, then 8% is not the same as adding 36%. For example, if the cost is $100, 28% + 8% is $138.24. At 36%, this price is $136.00.
- For your output screenshot, also include the following scenario: an Oil Change, Tune up, and Brake Job for an import would be 361.97 before taxes and labor and 545.42 after. Deliverables Submit files containing the following: 1) Java source file (.java file) 2) Screenshots of successful test run. 3) Screenshots of successful run including Tune Up, Brake Job, and Oil Change.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
- this assignment wants me to: Convert the QuartsToGallons program to an interactive application. Instead of assigning a value to the number of quarts, accept the value from the user as input. my code is . it is saying that they can not find symbol in quartsNeeded=input.NextInt(); final int QUARTS_IN_GALLON = 4; int quartsNeeded = 18; int gallonsNeeded; int extraQuartsNeeded; Scanner input = new Scanner(System.in); System.out.print("Enter quarts >>"); quartsNeeded = input.NextInt(); gallonsNeeded = quartsNeeded / QUARTS_IN_GALLON; extraQuartsNeeded = quartsNeeded % QUARTS_IN_GALLON; System.out.println("A job that needs " + quartsNeeded + " quarts requires " + gallonsNeeded + " gallons plus " + extraQuartsNeeded + " quarts.");arrow_forwardUse Java.arrow_forwardCan someone help me set up this code. I am very confused. All information is in the photos. There is also a template but I don’t know how to use it (if you would like to see the template contact me it won’t let me add more than 2 photos). Please please help! The instructions are on the photos as well.arrow_forward
- Q1) Write a method that checks whether two words are anagrams. Two words are anagrams if they contain the same letters in any order. For example, "silent" and "listen" are anagrams. Write a test program that prompts the user to enter two strings and, if they are anagrams, displays "anagram", otherwise displays "not anagram". Note: The header of the method is as follows: public static boolean isAnagram(String s1, String s2) Sample Input #1: Enter two strings: Silent listen Sample Output #1: The string “Silent” and “listen” are anagrams. Sample Input #1: Enter two strings: teach peach Sample Output #1: The string “teach” and “peach” aren’t anagrams.arrow_forwardPlease help with 3rd section (in images below), code for first and second class included below. Do not change the function names or given starter code in the script. Each class has different requirements, read them carefully. Do not use the exec or eval functions, nor are you allowed to use regular expressions (re module). All methods that output a string must return the string, not print it. If you are unable to complete a method, use the pass statement to avoid syntax errors. class Stack: def __init__(self): self.stack = [] def pop(self): if len(self.stack) < 1: return None return self.stack.pop() def push(self, item): self.stack.append(item) def size(self): return len(self.stack) def peek(self): return self.stack[self.size() - 1] def isEmpty(self): if len(self.stack) < 1: return True return False class Calculator: def __init__(self): self.__expr = None…arrow_forwardPlease help me create a trivia game using java. Please make the trivia game similar to games like guess the answer and text or die. The requirements for this program is down below in the photosarrow_forward
- Modify songVerse to play "The Name Game" (see OxfordDictionaries.com), by replacing "(Name)" with userName but without the first letter.Ex: If userName = "Katie" and songVerse = "Banana-fana fo-f(Name)!", the program prints:Banana-fana fo-fatie! Ex: If userName = "Katie" and songVerse = "Fee fi mo-m(Name)", the program prints:Fee fi mo-matie Note: You may assume songVerse will always contain the substring "(Name)" #include <iostream>#include <string>using namespace std; int main() {string userName;string songVerse; getline(cin, userName);userName = userName.substr(1, userName.size() - 1); // Remove first character getline(cin, songVerse); // Modify songVerse to replace (Name) with userName without first character /* Your solution goes here */ cout << songVerse << endl; return 0;} Please help me with this string operations problem using C++.arrow_forwardIn Chapter 7, you modified the GreenvilleRevenue program to include a number of methods. Now, using your code from Chapter 7 Case Study 1, modify your program so every data entry statement uses a TryParse() method to ensure that each piece of data is the correct type. Any invalid user entries should generate an appropriate message that contains the word Invalid, and the user should be required to reenter the data. An example of the program is shown below:arrow_forwardC# (Sharp): Using visual studio a). Make a math library with 3 methods with the same name (overload): First method accepts 2 integer parameters and returns the larger number. Second method accepts 3 integer parameters and returns the larger number. Third method accepts 4 integer parameters and returns the larger number. b). Make a console application that will use and test your library methods.arrow_forward
- The internet enables people to network, join a cause, take a poll, etc. Your program will prompt the user for a description of a poll to be taken and then prompt 5 users for a response of 1-10 (1 being a 'poor' response; 10 being the 'best' response).Your program does not have to validate that the user entered 1-10. We'll do that type of checking later.Your program must use a string data type to store the poll description and a Python list data type to save the integer responses of the 5 user responses.Your output should list all the responses stored in the list, the highest given response, the lowest given response and the average of the 5 responses. See sample input and utput below.Review powerpoint 3, slide 21 for an example if you need one. Sample interactive run of your program: Give a simple description of the poll to be takenRate your understanding of the first 3 zyBook chaptersEnter a 1-103Enter a 1-1010Enter a 1-104Enter a 1-102Enter a 1-105Sample outputRate your understanding…arrow_forwardWrite a program that allows a player to play Rock, Paper, and Scissors against the computer. In this version, if there is a tie the computer wins. The user must beat the computer to win around.The player will provide their name and the number of rounds they want to play. They will begin by entering their name and the number of rounds they would like to play. For each round, the player will input a character to represent their play (‘R’ for rock, ‘P’ for paper, or ‘S’ for scissors). The program will randomly select its play and output whether the player won or lost. After all, rounds have been completed the program will output the match-winner. In the case that the player wins the match, it will output their percentage of wins otherwise it will output the percentage of losses. Use the following functions / descriptions for your code. You may (should) add more functions as you deem necessary, but you may not omit or modify the functionality described below (Don’t forget you will also…arrow_forwardJava Your program will read in a credit card number and expiration date from the user and validate the data. The program will continue to ask for user input until a valid number and date are entered. The rules for what is valid are specified below. readYear() and readMonth(int) methods Complete the readYear() and readMonth(int) methods. These methods ask the user to input the expiration year and month of their credit card. Each method should contain a loop inside the method so the code repeats until a valid month or year is entered by the user. If the user enters an invalid year or month, print an error message and ask them to try again. The readMonth(int) method reads in the month as a number. A valid month is any number between 1 and 12 (inclusive). A valid year is 2022 or later. readCreditCardNumber() method Complete the readCreditCardNumber() method. This method asks the user to input their credit card number. This method should contain a loop so the code repeats until a valid…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education