7) Create the following using Java. Create a scanner Declare double variables for price and tax Declare character...

Free

70.2K

Verified Solution

Question

Programming

7) Create the following using Java.

Create a scanner
Declare double variables for price and tax
Declare character variable reply

Create do while loop
Inside of do loop
Prompt the console to display headline Product Price Check
Prompt the user to enter initial price and relate to scanner
Prompt the user to enter the tax rate and relate to scanner
Calculate price which is equal to price multiply (1+tax/100)
Display in console the cost after tax which is price

Check if user want to enter another product by (y/n)?
Declare replay equal to scanner .next.charAt(0)

Answer & Explanation Solved by verified expert
3.6 Ratings (552 Votes)

import java.util.Scanner; //Import the Scanner class
import java.util.*;
public class Product {
  

public static void main (String[] args ) {
          
       Scanner sc = new Scanner (System.in); //Create a Scanner object
  
int cost;
       char reply;
do{

   System.out.println(\"Product Price Check\");
   System.out.print(\" Enter Initial Product Price = \");
double myPrice = sc.nextInt(); //Read user input
System.out.print(\" Enter Tax rate of Product = \" );
double myTax = sc.nextInt(); //Read user input
   cost = myPrice*(1+(myTax/100));
   System.out.println(\"cost after tax of the product = \" +cost); //output user input
   System.out.print(\"you want to enter another product? (y/n)\");

   reply= sc.next().charAt(0);

   }

   while( reply=='y' || reply=='Y');
  
    }
}



Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students