Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Homework;
- import java.util.Scanner;
- import java.text.DecimalFormat;
- public class Hliday3 {
- public static void main (String [] args){
- DecimalFormat df= new DecimalFormat ("0.00");
- Scanner keyboard=new Scanner (System.in);
- final double VATRATE=0.20;
- String clientName;
- System.out.println ("What is your name?");
- clientName=keyboard.nextLine();
- int noOfAdults;
- int noOfChildren;
- System.out.println ("How many adults are travelling?");
- noOfAdults=keyboard.nextInt();
- System.out.println ("How many children are travelling?");
- noOfChildren=keyboard.nextInt();
- double adultFlight;
- double childFlight;
- System.out.println ("How much is an adult flight?");
- adultFlight=keyboard.nextDouble();
- System.out.println ("How much is a child flight?");
- childFlight=keyboard.nextDouble();
- Double totalCost;
- totalCost=noOfAdults*(adultFlight*(1+VATRATE))+noOfChildren*(childFlight*(1+VATRATE));
- System.out.println ("User Name: "+clientName);
- System.out.println ("Total cost of trip: "+totalCost);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement