Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

I'm stuck on my code and need help rewriting it so there are no syntax errors. Here's my code. I've also included two pictures - one of my syntax errors (there are 11) and another of what the output of the code should look like. Please try to keep the code as similar to the original as possible.

CODE

//Importing scanner
import java.util.Scanner;

public class CarMaintanenceAssignment
{
//Method 1
public static double carMaintenance(String carMake)
{
Scanner input = new Scanner(System.in);

double accum = 0;
char yn;

System.out.println(" Services: Oil Change, Tune up, Brake Job, Transmission Service, respectively: 59.99, 111.99, 189.99, 149.99");
System.out.println(" ");

//Prompting user for the make of their car
System.out.println("Please select the service that you want for your " + carMake);

//Asking user if they want an oil change
if(yn.equalsIgnoreCase('Y'))
{
accum += 59.99;
}

System.out.println("Coolant Flush : Please enter Y or N =");
yn = sc.next().charAt(0);
if(yn.equalsIgnoreCase('Y'))
{
accum += 111.99;
}

System.out.println("Brake Job : Please enter Y or N =");
yn = sc.next().charAt(0);

if(yn.equalsIgnoreCase('Y'))
{
accum += 189.99;
}

System.out.println(" Tune Up : Please enter Y or N =");
yn = sc.next().charAt(0);

if(yn.equalsIgnoreCase('Y'))
{
carMaintanancePrice += 149.99;
}
return accum;

//Method 2
public static void calcFinalPrice(double accum, Boolean carImport)
{
double labor = 0.25 * accum;
accum += labor;

//If statement for car import
if(carImport)
{
accum += 0.06 * accum;
}

accum += 0.07 * accum;

//Outputting final price
System.out.println("The Final Price with Taxes and Labor = " +accum);
}

public static void main(String [] args)
{
Scanner input = new Scanner(System.in);

String carMake;
String answer;
boolean carImport = false;

//Prompting user to enter the make of their car
System.out.println("Enter the Make of your Car?");
carMake = input.nextLine();

//Asking user if their car is an import or not
System.out.println("Is your Car an Import Model?");
answer = input.nextLine();

if(answer.equalsIgnoreCase("yes"))
{
carImport = true;
}

//Calling method 1 for accum
double accum = carMaintenance(carMake);
System.out.println("Total price before Tax and Labor = " + accum);

//Calling method 2 for final price
calcFinalPrice(accum, carImport);
}
}
}

- END OF CODE -

[画像:CarMaintanenceAssignment.java:49: error: illegal start of expression public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:49: error: illegal start of expression public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:49: error: ';' expected public static void calcfinalPrice(double accum, Boolean carImport) .class' expected CarMaintanenceAssignment.java:49: error: public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:49: error: ';' expected public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java: 49: error: ';' expected public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:66: error: illegal start of expression public static void main(String [] args) CarMaintanenceAssignment.java:66: error: illegal start of expression public static void main(String [] args) CarMaintanenceAssignment.java: 66: error: ';' expected public static void main(String [] args) .class' expected CarMaintanenceAssignment.java:66: error: public static void main(String [] args) CarMaintanenceAssignment.java:66: error: ';' expected public static void main(String [] args) 11 errorS ]
expand button
Transcribed Image Text:CarMaintanenceAssignment.java:49: error: illegal start of expression public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:49: error: illegal start of expression public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:49: error: ';' expected public static void calcfinalPrice(double accum, Boolean carImport) .class' expected CarMaintanenceAssignment.java:49: error: public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:49: error: ';' expected public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java: 49: error: ';' expected public static void calcfinalPrice(double accum, Boolean carImport) CarMaintanenceAssignment.java:66: error: illegal start of expression public static void main(String [] args) CarMaintanenceAssignment.java:66: error: illegal start of expression public static void main(String [] args) CarMaintanenceAssignment.java: 66: error: ';' expected public static void main(String [] args) .class' expected CarMaintanenceAssignment.java:66: error: public static void main(String [] args) CarMaintanenceAssignment.java:66: error: ';' expected public static void main(String [] args) 11 errorS
Transcribed Image Text:What is the Make of your Car? BMW Is your Car an Import Model? yes Services: Oil Change, Tune Up, Brake Job, Transmission Service Prices, respectively: 59.99, 111.99, 189.99, 149.99 Please select the services that you want for your BMW oil Change : Please enter Y or N = Y Tune Up : Please enter Y or N = Y Brake Job : Please enter Y orN = Y Transmission Service : Please enter Y or N = N Total Price before Tax and labor = 361.97 The Final Price with Taxes and Labor = 545.42
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education