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

  Initializing static fields

Why do static ?elds of a class have to be initialized when the class is loaded? Why can't we initialize static ?elds when the program starts? Give an example of what goes wrong if, instead of static ?elds being initialized too early, they are init..

  The department of community affair- jail report

The Department of Community Affairs (DCA) for the State of Georgia performs many functions including gathering statistics and doing research. DCA provides a monthly jail report that provides some interesting information about jails in the state.

  Practice using recursion with data structures

Write a recursive method in this class called hasSameStructureAs(BinaryTree tree) that returns whether or not a tree has the same structure as another tree.

  Design implement test and debug a program with a jframe

design implement test and debug a program with a jframe that allows the user to enter a series of contacts names ages

  Create a package called people

Create a second package called ‘task01'. Within this package provide classes which perform the following tasks.

  Briefly explain how arrays could be used in the above app

A Chartered Financial Analyst wants a program that will produce a report to show her clients the benefits of saving for retirement

  Why do i not create a constructor for an applet

When should one use applets and when should one use servlets? Why do I not create a constructor for an applet? Why doesn't appletviewer appletclass.class work?

  Calculate the new date by adding a fixed number of days

What I have done is the "ExtendedDate.java", which improved the "data.java" that the program will firstly check if the date input from users is valid then store it with the setDate method.

  Converting pseudocode to javascript

I would need help in converting converting pseudocode to JavaScript. I already have the pseudocode in a html file but need it to be converted to JavaScript and run like it should.

  Java program by array

Write a program that reads in a file that contains one integer per line. Each integer represents one location in the image. Assume that there are 64 rows and 64 columns in the image

  Design a class that can be used to hold information

Implement and design a class that can be used to hold information about a musical note - Prepare a complete java program the default constructor should set a note to a middle C quarter note.

  Design a java application to read a file containing data

Design a Java application that will read a file containing data related to the passengers on the Titanic. The description of the file is shown below. The application should provide statistical results on the passengers including

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