Question

In: Computer Science

Create an application named Rusty2 that asks the user for the dealer cost of a car,...

Create an application named Rusty2 that asks the user for the dealer cost of a car, and the cleaning cost, and then displays the retail cost. Your application should simply send the dealer cost and cleaning cost to the getRetailPrice method in the Dealership class to obtain the retail cost.

here below is the dealership class code amd meed to create rusty2 code

import java.util.Calendar;
public class Dealership {

// public static final class variables

public static final int YEAR_STARTED = 1995;
public static final String COMPANY_NAME = "The Rusty Lemon";
public static final String COMPANY_URL = "www.TheRustyLemon.com";
public static final String COMPANY_ADDRESS = "123 Rustbelt Road, Somewhere, SomeState, 12345";
public static final String COMPANY_SLOGAN = "Many parts of our cars run great!";
public static final double STANDARD_MARKUP = 0.50;
public static final String COMPANY_EMAIL = "[email protected]";


// public static methods

public static String getCompanyBanner() {

return COMPANY_NAME + "\n(Selling rusty lemons since "
+ YEAR_STARTED + ")\n" + COMPANY_ADDRESS + "\n"
+ COMPANY_URL + "\n" + COMPANY_SLOGAN + "\n";

}

public static double getRetailPrice(double dealerCost, double cleaningCost) {

double markup = dealerCost * STANDARD_MARKUP;
return dealerCost + cleaningCost + markup;

}
public static int getYearsInBusiness()
{
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
int yearsInBusiness = currentYear - YEAR_STARTED;
return yearsInBusiness;

}
}

Solutions

Expert Solution

Solution:

Rusty2.java:

import java.util.*;
public class Rusty2 {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       //Asking user to inout the value of Dealer cost
       System.out.println("Enter Dealer cost: ");
       double dealerCost = sc.nextDouble();
       //Asking the user to input cleaning cost
       System.out.println("Enter Cleaning cost: ");
       double cleaningCost = sc.nextDouble();
       //creating a new variable retailCost
       double retailCost;
       //creating a new dealership object
       Dealership dealership = new Dealership();
       //Now we are calling the fetReatilprice method of dealership class using the dealership object and storing the return value in retailCost
       retailCost = dealership.getRetailPrice(dealerCost,cleaningCost);
       //Printing the retailCost
       System.out.println("Retail cost is " + retailCost);
       return;
   }
}
Output:


Related Solutions

C# A car dealer wants an application that calculates the cost of a car. The GUI...
C# A car dealer wants an application that calculates the cost of a car. The GUI application should link the “BuildYourCar.accdb” database and display all the data in four different “ListBox” based on the category. Each “ListBox” should display all the items in that category. The user can only choose one item from each “ListBox” to add an item to a car. As each item is selected, the application displays the item in a separate “ListBox” to display. If user...
Create a program that asks the user for the names of two car dealerships and the...
Create a program that asks the user for the names of two car dealerships and the # of cars sold in each one. Then output that data in two columns as shown below. The "Store location" column has a width of 25, while the "Cars sold" column has a width of 9. Also, notice the alignment of the second column. The program should end with the "Press Enter to end this program" prompt. OUTPUT Enter the location for the first...
Create an application that asks a user to answer 5 math questions. JAVA
Create an application that asks a user to answer 5 math questions. JAVA
Create an application for a library and name it FineForOverdueBooks. TheMain() method asks the user to...
Create an application for a library and name it FineForOverdueBooks. TheMain() method asks the user to input the number of books checked out and the number of days they are overdue. Pass those values to a method named DisplayFine that displays the library fine, which is 10 cents per book per day for the first seven days a book is overdue, then 20 cents per book per day for each additional day. The library fine should be displayed in the...
Create an application that allows the user to place an order at a coffee shop named...
Create an application that allows the user to place an order at a coffee shop named Zips Coffee. Create a coffee order form that looks like a table with columns for coffee type, price and quantity. Provide values for at least three rows of data. Provide a row for the total cost of your order. Create Javascript code to calculate the total of your order and present the total to the user. Provide a button to initiate the Javascript described...
C# Create an application that asks the user to enter their new password. The password must...
C# Create an application that asks the user to enter their new password. The password must be at least 6 characters long. Develop a custom exception handling case that checks for the password length. (hint: use " .Length " built-in method). If the new password is less than 6 characters long the custom exception should output an error message.
C# Create a console application that asks the user for two numbers in the range 0-255...
C# Create a console application that asks the user for two numbers in the range 0-255 and then divides the first number by the second: Enter a number between 0 and 255: 100 Enter another number between 0 and 255: 8 100 divided by 8 is 12 Enter a number between 0 and 255: apples Enter another number between 0 and 255: bananas FormatException: Input string was not in a correct format.
1) Write Java application that asks the user to enter the cost of each apple and...
1) Write Java application that asks the user to enter the cost of each apple and number of apples bought. Application obtains the values from the user and prints the total cost of apples. 2) Write a java application that computes the cost of 135 apples, where the cost of each apple is $0.30. 3)Write a java application that prepares the Stationery List. Various entries in the table must be obtained from the user. Display the Stationary list in the...
Create an C# application named ConvertMilesToKilometers whose Main() method prompts a user for a number of...
Create an C# application named ConvertMilesToKilometers whose Main() method prompts a user for a number of miles, passes the value to a method that converts the value to kilometers, and then returns the value to the Main() method where it is displayed.
Write an application that asks a user to type an even number or the sentinel value...
Write an application that asks a user to type an even number or the sentinel value 999 to stop. When the user types an even number, display the message “Good job!” and then ask for another input. When the user types an odd number, display an error message, "x is not an even number", and then ask for another input. When the user types the sentinel value 999, end the program.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT