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

  Write programs that read a line of input

Write programs that read a line of input as a string and input

  Create wheel 360 degree

You have to create wheel, 360 degree. That is numbered 0-36. it is supposed to be spun, and randomly lands on one of the numbers.

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  Write a java sorting application with two classes

Write a Java Sorting Application with two classes, JavaSort and JavaSortTest. Your JavaSort Class, as a minimum must contain sorting methods for BubbleSort, InsertionSort, ShellSort, MergeSort, and QuickSort.

  Benefits of using java as a programming language

What are the benefits of using Java as a programming language? Discuss how the use of an integrated development environment (IDE) such as Eclipse enhances programmer productivity

  You need to find out the average score how many scores are

suppose that you have an array of baseball scores type integer called scores. the values in the array are ordered from

  What is the purpose of using javascript on a website

What is the purpose of using JavaScript on a website. What is a specific example of a JavaScript application that will be beneficial on the site you are creating. Use an example other than from validation.

  Simulate a simple version of a game called liar dice

The first player claims a Poker hand (see "Hand Ranks" below for legal calls). When making a claim, a player says what all five dice are, not just the name of the hand. For example, a player should say, "I have a full house: three 4s and two 5s," ..

  What is method overloading

1. What is method overloading? 2. What is the purpose of a constructor? 3. How do you call a method of one class from a method of another class?

  Application that reads the lengths of sides of a triangle

Write a java application that reads the lengths of the sides of a triangle from the user.

  Represent the relationship between parents - children class

Draw a class diagram that represents the relationship between parents, children, and grandparents. Take into account that a person can have both a parent and a child. Annotate associations with roles and multiplicities.

  Writing a program to manage a student database

Writing a program to manage a student database. The interface to the program should be a GUI that looks similar to the following: A combo box should allow the user to select one of the three database actions shown

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