Write a program to prepare the monthly charge account

Assignment Help JAVA Programming
Reference no: EM131001377

Write a program to prepare the monthly charge account statement for a customer of CS CARD International, a credit card company. The program should take as input the previous balance on the account and the total amount of additional charges during the month. The program should then compute the interest for the month, the total new balance (the previous balance plus additional charges plus interest), and the minimum payment due. Assume the interest is 0 if the previous balance was 0 but if the previous balance was greater than 0 the interest is 2% of the total owed (previous balance plus additional charges). Assume the minimum payment is as follows:

new balance         for a new balance less than $50
$50.00            for a new balance between $50 and $300 (inclusive)
20% of the new balance   for a new balance over $300

So if the new balance is $38.00 then the person must pay the whole $38.00; if the balance is $128 then the person must pay $50; if the balance is $350 the minimum payment is $70 (20% of 350). The program should print the charge account statement in the format below. Print the actual dollar amounts in each place using currency format from the NumberFormat class-see Listing 3.4 of the text for an example that uses this class.

CS CARD International Statement
===============================

Previous Balance: $

Additional Charges: $ Interest: $

New Balance: $

66

Chapter 6: More Conditionals and Loops

Minimum Payment: $

 

The code below is my answer for this work, but when I compile, it is showing error, which I could not figure what exactly it is. 

 1  import java.util.*;
 2 public class ChargeAccount{
 3    
 4    public static void main(String[] args){
 5    
 6       Scanner scan = new Scanner(System.in);
 7       System.out.println("Please enter your previous balance");
 8       double prevb = scan.nextDouble();
 9       System.out.println("Please enter the total charges");
10       double totalb = scan.nextDouble();
11       double interest;
12       if (prevb==0){
13          interest = 0.0;
14       }
15       else{
16          interest = 0.02*(totalb+prevb);
17       }
18       double newb = totalb + prevb + interest;
19       double minPay;
20       if(newb < 50){
21          minPay = newb;
22       }
23       else if(newb < 300){
24          minPay = 50;
25       }
26       else
27          minPay = newb*(20/100);
28       }
29       System.out.println("Previous balance was: "+prevb);
30       System.out.println("Total charges: "+totalb);
31       System.out.println("Interest is: "+interest);
32       System.out.println("New balance is: "+newb);
33       System.out.println("Minimum pay is: "+minPay);

Reference no: EM131001377

Questions Cloud

The user for number of letters : Write a java program that asks the user for number of letters in a word followed by those letters. Store those letters in an array. Then it calls a method called public static void toNumerals(char[] word) to determine the corresponding number for eac..
A program with main() would produce output below : A  program with main() would produce output below - Your code ...Calling getLargestUncommonDigit()
Evaluates an arithmetic expression in postfix expression : Bring a hardcopy of your source code to class in order to submit. Please staple multiple pages together. Write a program that evaluates an arithmetic expression in postfix expression. In your program you will need a stack implemented as a linked list..
Prepare a summary journal entry to record the monthly : Prepare a summary journal entry to record the monthly bad debt accrual and the write-offs during the year.
Write a program to prepare the monthly charge account : Write a program to prepare the monthly charge account statement for a customer of CS CARD International, a credit card company. The program should take as input the previous balance on the account and the total amount of additional charges during the..
Unique index integer fields : Unique index integer fields Use at least 5 other fields of various, including at least one of each of String, int and double types. assume that the String's have no spaces within them
Write a program to play the rock-paper-scissors game : Game Program Write a program to play the rock-paper-scissors game. Two users take turns entering R, P, or S. The program then announces the winner, based on the rule that paper covers rock, rock breaks scissors, scissors cut paper.
What is the amount of accounts receivable due from customers : What is the amount of accounts receivable due from customers at the end of 2009 and 2008?
What would be the net amount of accounts receivable : For situations (a)-(c) in requirement 2 above, what would be the net amount of accounts receivable reported in the 2011 balance sheet?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd