Cost Calculation

# Cost Calculation - process double discountRate = 0...

This preview shows pages 1–2. Sign up to view the full content.

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package costcalculator; import java.util.Scanner; /** * * @author Manuel Duenas */ public class CostCalculator { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here // input Scanner in = new Scanner(System.in); System.out.println("what is your rating?: "); int rating = in.nextInt(); System.out.println("what is the purchase price?: "); double purchaseCost = in.nextDouble();

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // process double discountRate = 0; if (rating == 1) { discountRate = 0; } else if ((rating == 2) && (purchaseCost > 50)) { discountRate = .1; } else if ((rating == 2) && (purchaseCost < 50)) { discountRate = 0; } else if ((rating == 3) && (purchaseCost > 100)) { discountRate = .25; } else if ((rating == 3) && (purchaseCost < 100)) { discountRate = .1; } else { System.out.println("wrong imput, try again"); System.exit(0); } System.out.println("Discount Rate is: " + discountRate * 100 + "%"); } }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

Cost Calculation - process double discountRate = 0...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online