Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MainClass {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner mySc = new Scanner(System.in);
- int id;
- int nbGame;
- double gPrice;
- //double fPrice;
- System.out.println("Welcome to game center :).");
- System.out.print("Please, Enter the game id:");
- id = mySc.nextInt();
- System.out.print("Please, Enter the price of a game:");
- gPrice = mySc.nextDouble();
- System.out.print("Please, Enter number of games:");
- nbGame = mySc.nextInt();
- //System.out.println("");
- System.out.println((nbGame == 0)?"Error" : (nbGame>2)?"Total price for game "+id+" is "+((double)nbGame*gPrice - (double)nbGame*gPrice*0.2)+" SR":"Total price for game "+id+" is "+((double)nbGame*gPrice) +" SR");
- mySc.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement