B. REQUIREMENT STATEMENT THIS DESIGN IS NOT COMPLETELY THE SAME THE REAL CREDIT
ID: 3735126 • Letter: B
Question
B. REQUIREMENT STATEMENT THIS DESIGN IS NOT COMPLETELY THE SAME THE REAL CREDIT CARD SERVict. THEREFORE, SOME TASS DO NOT EXACT AS THE REAL CREDIT CARD SERVOS, I JUST MAKE IT SIMPLE ATYOUR VEL TO APPLY wilAr YOU ALREADY LEARNED. EACH TIME YOU RUN THE APPLICATION; JUST TAKE CARE ONLY ONE ACCOUNT Create an application for the Credit Card service that allow users can do the following tasks: CREDIT CARD SERVICE MENO 1. Open new credit card 2. One transaction 3. Print statenent 4. Payment s. Get Available credit amount 6. Get Interet rate After finishing one task, redisplay the menu to allow users to select other tasks until they want to exit Each credit card account will hold the following information: name (String), card number (String), SS number (String), phone number (String), address (String), username (String), password (String), credit line (double $2000) available credit (double, start with credit line amount), current balance (double), minimum balance (double), interest rate (double) Also, the credit card account will provide the information for all the tasks listed on the menu TASK 1: Open new credit card -Ask users the new credit card account -display the message: to enter the information: name, SS numbers, phone number, address, username, password to create Credit Card is aasiable tor vou Nanei card numbez Credit Line 2430371220124047 000.0 Intezes Rater 16-99 Where the credit card number is a numeric string with 16 digits that is combined from 4 random 4-digit .Explanation / Answer
Requirements are not clear and document is not attached .
I assume you want to make a program for Credit Card .
So here is the code.
CreditCardAccount .java
import java.util.Scanner;
public class CreditCardAccount {
private int cardnumber;
private String name;
private int creditlimit;
int creditamount;
//Constructor
public CreditCardAccount(int cardnumber, String name, int creditlimit) {
super();
this.cardnumber = cardnumber;
this.name = name;
this.creditlimit = creditlimit;
this.creditamount = 0;//initial amount
}
public void charges() {
Scanner in = new Scanner(System.in);
//int creditLimit = 500000;
int numofdays;
double charges = 0;
System.out.println("Enter credit amount");
creditamount = in.nextInt();
System.out.println("Enter number of days ");
numofdays = in.nextInt();
if (numofdays < 10) {
charges = creditamount * 0.15;
} else if (numofdays >= 10 && numofdays < 30) {
charges = creditamount * 0.2;
}
creditamount=(int) charges;
System.out.println("charges paid " + charges);
}
public void payments(int cash) {
int balance;
balance = creditamount - cash;
System.out.println("Blance aamount =" + balance);
}
@Override
public String toString() {
return "CreditCardAccount [cardnumber=" + cardnumber + ", name=" + name + ", creditlimit=" + creditlimit
+ ", creditamount=" + creditamount + "]";
}
}
TestCreditCardAccount .java
public class TestCreditCardAccount {
public static void main(String[] args) {
// Creating three instances
CreditCardAccount person1 = new CreditCardAccount(452133, "Kamal Kumar S", 1000000);
CreditCardAccount person2 = new CreditCardAccount(452199, "tendra P", 500000);
CreditCardAccount person3 = new CreditCardAccount(4519880, "Nagendra B", 2000000);
// For Person 1
// Call charges
person1.charges();
// call payments
person1.payments(100);
System.out.println(person1);
// For Person 2
// Call charges
person2.charges();
// call payments
person2.payments(200);
System.out.println(person2);
// For Person 3
// Call charges
person3.charges();
// call payments
person3.payments(300);
System.out.println(person3);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.