0% found this document useful (0 votes)
5 views

Lecture 3 Activity task 1

The Java program calculates sales tax for two products: Shampoo and Toothpaste. Users can select a product and input its price, with specific price ranges determining the applicable sales tax rates. If an invalid product is selected, the program prompts the user to run it again.

Uploaded by

40096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lecture 3 Activity task 1

The Java program calculates sales tax for two products: Shampoo and Toothpaste. Users can select a product and input its price, with specific price ranges determining the applicable sales tax rates. If an invalid product is selected, the program prompts the user to run it again.

Uploaded by

40096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Class Activity Mark 1

import java.util.Scanner;
class Main{
public static void main(String[] args){

int price , product;


Scanner product_type =new Scanner(System.in);

System.out.println("For checking sales tax on Shampoo (Press 1): ");


System.out.println("For checking sales tax on Toothpaste (Press 2): ");

product = product_type.nextInt();

if( product ==1 ){


System.out.println("Enter the price of the product: ");
price = product_type.nextInt();

if ( price>50 && price<500 ){


float sales_tax = (price)*3/100;
System.out.println("The sales tax of your product is :" +
sales_tax);
}
}

else if( product==2 ){


System.out.println("Enter the price of the product: ");
price = product_type.nextInt();

if( price>100 && price<999 ){


float sales_taxes = (price)*5/100;
System.out.println("The sales tax of your product is :" +
sales_taxes);
}
}

else{
System.out.println("Invalid Product! Again run the program.....");
}
}
}

You might also like