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 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.
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.
Create an application that makes the user guess a number. The user must be allowed tries....
Create an application that makes the user guess a number. The user must be allowed tries. You must have a loop, user input (Scanner), and a constructor. (JAVA)
Create a function named getCreds with no parameters that will prompt the user for their username...
Create a function named getCreds with no parameters that will prompt the user for their username and password. This function should return a dictionary called userInfo that looks like the dictionaries below: # Administrator accounts list adminList = [ { "username": "DaBigBoss", "password": "DaBest" }, { "username": "root", "password": "toor" } ] Create a function named checkLogin with two parameters: the userInfo and the adminList. The function should check the credentials to see if they are contained within the admin...
Write an application named MultiplicationTable that prompts the user for an integer value, for example 7....
Write an application named MultiplicationTable that prompts the user for an integer value, for example 7. Then display the product of every integer from 1 through 10 when multiplied by the entered value. For example, the first three lines of the table might read 1×7=7 , 2×7=14 , and 3×7=21 using a Loop other than While if
Create a java Swing GUI application that presents the user with a “fortune”. Create a java...
Create a java Swing GUI application that presents the user with a “fortune”. Create a java Swing GUI application in a new Netbeans project called FortuneTeller. Your project will have a FortuneTellerFrame.java class (which inherits from JFrame) and a java main class: FortuneTellerViewer.java. Your application should have and use the following components: Top panel: A JLabel with text “Fortune Teller” (or something similar!) and an ImageIcon. Find an appropriate non-commercial Fortune Teller image for your ImageIcon. (The JLabel has a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT