# CSCard - compute minimum payment if(newBalance< 50...

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

// ************************************************************************ // CSCard.java // // Determines the interest, new balance and minimum payement for a credit // card when given the previous balance and new charges. // // ************************************************************************ import java.util.Scanner; import java.text.NumberFormat; public class CSCard { public static void main(String[] args) { double prevBalance; double newCharges; double interest, newBalance, minPayment; Scanner scan = new Scanner (System.in); System.out.print("Enter the previous balance: "); prevBalance = scan.nextDouble(); System.out.print("Enter the total new charges: "); newCharges = scan.nextDouble(); // compute interest at 2% if (prevBalance == 0) interest = 0; else interest = 0.02 * (prevBalance + newCharges); // compute new balance newBalance = prevBalance + newCharges + interest;

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: // compute minimum payment if (newBalance < 50) minPayment = newBalance; else if (newBalance <= 300) minPayment = 50; else minPayment = newBalance * 0.2; // print results NumberFormat money = NumberFormat.getCurrencyInstance(); System.out.println("\tCS CARD International Statement"); System.out.println("\t==============================="); System.out.println(); System.out.println("\tPrevious Balance:\t" + money.format(prevBalance)); System.out.println("\tAdditional Charges:\t" + money.format(newCharges)); System.out.println("\tInterest:\t\t" + money.format(interest)); System.out.println(); System.out.println("\tNew Balance:\t\t" + money.format(newBalance)); System.out.println(); System.out.println("\tMinimum Payment:\t" + money.format(minPayment)); } }...
View Full Document

## This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

### Page1 / 2

CSCard - compute minimum payment if(newBalance< 50...

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

View Full Document
Ask a homework question - tutors are online