Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class GameCenter{
- public static void main(String []args){
- Scanner input =new Scanner(System.in);
- //varables
- double totalPrice=0;
- double priceAfterDiscount=0;
- System.out.println("Welcome to Gaming Center");
- System.out.println("please enter game Id");
- int id=input.nextInt();
- System.out.println("please enter the price of games");
- double price=input.nextDouble();
- System.out.println("please enter number of games");
- int num=input.nextInt();
- if(num<1)
- System.out.println("error");
- else{
- double Discount=20.0/100.0;
- totalPrice=price*num;
- if (num>2){
- priceAfterDiscount=totalPrice*(1-Discount);
- System.out.print("Total price for game "+id+" is:"+priceAfterDiscount+"SR");
- }
- else
- System.out.print("Total price for game "+id+" is:"+totalPrice+"SR");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement