SHARE
TWEET

Untitled

a guest Oct 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Homework;
  2.  
  3. import java.util.Scanner;
  4. import java.text.DecimalFormat;
  5.  
  6. public class Hliday3 {
  7.     public static void main (String [] args){
  8.  
  9.         DecimalFormat df= new DecimalFormat ("0.00");
  10.         Scanner keyboard=new Scanner (System.in);
  11.  
  12.         final double VATRATE=0.20;
  13.  
  14.         String clientName;
  15.         System.out.println ("What is your name?");
  16.         clientName=keyboard.nextLine();
  17.  
  18.  
  19.         int noOfAdults;
  20.         int noOfChildren;
  21.  
  22.         System.out.println ("How many adults are travelling?");
  23.         noOfAdults=keyboard.nextInt();
  24.         System.out.println ("How many children are travelling?");
  25.         noOfChildren=keyboard.nextInt();
  26.  
  27.         double adultFlight;
  28.         double childFlight;
  29.  
  30.         System.out.println ("How much is an adult flight?");
  31.         adultFlight=keyboard.nextDouble();
  32.         System.out.println ("How much is a child flight?");
  33.         childFlight=keyboard.nextDouble();
  34.  
  35.         Double totalCost;
  36.         totalCost=noOfAdults*(adultFlight*(1+VATRATE))+noOfChildren*(childFlight*(1+VATRATE));
  37.  
  38.  
  39.         System.out.println ("User Name: "+clientName);
  40.         System.out.println ("Total cost of trip: "+totalCost);
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top