Question: In this program, you will purchase an new tablet or laptop. Sample run: Enter the your name: Hello John, are you buying a tablet or
In this program, you will purchase an new tablet or laptop.
Sample run:
Enter the your name:
Hello John, are you buying a tablet or laptop?
Enter the amount for your tablet:
You entered: $
Tax: $
Total Cost: $
import java.util.Scanner;
public class ComputerPurchase
private static Scanner CONSOLE new ScannerSystemin; Declare and instantiate console as a Scanner
private static double SALESTAX ; Declare a named constant for the sales tax SALESTAX and assign to the variable
public static void mainString args
String strName "Acer Laptop";
String strDevice "Laptop";
double dblAmount $;
double dblTaxes $;
double dblTotalCost $;
Declare the below variables and initialize them to their default values.
strName, strDevice, dblAmt, dblTaxes, dblTotalCost
System.out.printEnter your name: ;
Prompt for and input the users name.
Prompt for and input the type of device the user is buying
Prompt for and input the device amount
Display to the user the amount entered and go to the next line.
Calculate the taxes using the constant variable above.
Display the taxes and go to the next line.
Calculate the Total Cost
Display the Total Cost.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
