Question

In: Computer Science

Write a program in java which calculates the total price of an item you purchased which...

Write a program in java which calculates the total price of an item you purchased which includes sales tax. Create a Scanner object to read information from keyboard, Display prompts and get input, perform the calculation and display the Result of the program.

Solutions

Expert Solution

//Java program

import java.util.Scanner;

public class Price {
   public static void main(String args[]) {
       Scanner in = new Scanner(System.in);
       double itemCost,taxRate,totalPrice;
      
       System.out.print("Enter purchase cost of item : $");
       itemCost = in.nextDouble();
      
       System.out.print("Enter sale tax rate : ");
       taxRate = in.nextDouble();
      
       totalPrice = itemCost*(1+taxRate/100);
      
       System.out.printf("Total Price of item : $%.2f",totalPrice);
       in.close();
   }
}
//sample output


Related Solutions

Write a JAVA program that prompts a famer's market associate for the price of each item...
Write a JAVA program that prompts a famer's market associate for the price of each item purchased by the customer and calculate their total. Use a do while loop to allow for the associate to enter as many items as necessary. Use 0 as a sentinel. If the customer spends at least $50, they receive a 15% discount. If the customer qualifies for the discount, output a statement informing them of this as well as their new total with the...
Please use Phyton to write a program: Write a program that calculates and displays the total...
Please use Phyton to write a program: Write a program that calculates and displays the total bill at a restaurant for a couple that is dining. The program should collect from the couple, cost of each meal, and the percentage of the final cost that they would like to tip. The sales tax in the state where the restaurant exists is 7.5%. Display to the user, line by line: Total Cost of Both Meals Sales Tax in dollars Tip in...
IN JAVA Write a program that calculates the occupancy rate for each floor of a hotel....
IN JAVA Write a program that calculates the occupancy rate for each floor of a hotel. (Use a sentinel value and please point out the sentinel in bold.) The program should start by asking for the number of floors in the hotel. A loop should then iterate once for each floor. During each iteration, the loop should ask the user for the number of rooms on the floor and the number of them that are occupied. After all the iterations,...
Write a java program that calculates a speeding fine. The user is prompted for the speed...
Write a java program that calculates a speeding fine. The user is prompted for the speed of the vehicle, the posted speed limit and if the offence took place in the construction zone. The fine is calculated at $75 + 3$/ km over the speed limit for the first 20km over + $6 / km for the next 20 and $9/km after that. If the posted limit is 40km, the fine is doubled. If the offence took place in a...
Write a Java program that calculates a random number 1 through 100. The program then asks...
Write a Java program that calculates a random number 1 through 100. The program then asks the user to guess the number.If the user guesses too high or too low then the program should output "too high" or "too low" accordingly.The program must let the user continue to guess until the user correctly guesses the number. ★Modify the program to output how many guesses it took the user to correctly guess the right number
Your task is to write a program in C or C++ that calculates the total amount...
Your task is to write a program in C or C++ that calculates the total amount of money a person has made over the last year. Your program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based...
Needs to be in JAVA. Write a Java program that accepts the total amount of cars...
Needs to be in JAVA. Write a Java program that accepts the total amount of cars sold and total sales amount of a car salesperson for a given month. The salesperson’s paycheck is computed as follows: a. Every sales person gets 10% (commission) of total sales b. Sales totals greater than $50,000 get 5% of total sales amount c. 8 or more cars sold earns the salesperson an extra 3% Please remove 30% (taxes) of the gross pay and list...
Question 2: Write a java program that calculates the weighted average of three grades using the...
Question 2: Write a java program that calculates the weighted average of three grades using the method with header public static double CalculateWeightedAverage (double grade1, double grade2, double grade3), such that: [4 Marks] Weighted average = grade1 * 0.5 + grade2 * 0.25 + grade3 * 0.25 The program in the main method will: o ask the user to enter the three grades o and then call the method that will calculate the weighted average o and finally display the...
jgrasp environment, java write a complete program that calculates a restaurant bill. Prompt the user for...
jgrasp environment, java write a complete program that calculates a restaurant bill. Prompt the user for the check amount, then ask the user what type of tipp they would like to leave: the choices are 1 for good tip (20%), 2 for an average tip (15%), or 3 for poor tip (10%). Use their input and an if-else to calculate the tip amount. Then calculate and output the final bill: check+tip print out the bill, exactly as shown (print the...
Write a Java program that calculates the blood alcohol content of someone drinking Jagerbombs. Assume that...
Write a Java program that calculates the blood alcohol content of someone drinking Jagerbombs. Assume that there are 0.55 ounces of alcohol in one Jagerbomb. Pick values of your own choosing for the number of drinks and the weight. Also output whether or not the person would be legally intoxicated in your state. The following formula gives a rough estimate of your blood alcohol content (BAC) and is derived from formulas posted by the National Highway Traffic safety administration: BAC...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT