Cost Calculation

Cost Calculation - // process double discountRate = 0; if...

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

View Full Document Right Arrow Icon
/* * 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();
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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

Page1 / 2

Cost Calculation - // process double discountRate = 0; if...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online