Question
JAVA Design a class to represent a credit card. Think about the attributes of a credit card; that is, what data is on the card?
JAVA
Design a class to represent a credit card. Think about the attributes of a credit card; that is, what data is on the card? What behaviors might be reasonable for a credit card? Repeat Exercise for a credit card account instead of a credit card. An account represents the charges and payments made using a credit card.
I want then give three examples of instances of this class.
Is the code used
package Exercises2;
import java.util.Scanner;
public class CreditCardAccount {
private int cardnumber; private String name; private int creditlimit; int creditamount;
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 && numofdays
public void payments(int cash) {
int balance; balance = creditamount - cash; System.out.println("Blance aamount =" + balance); } }
enumeration>> customer I cardnumber: 452133 name: Kamal Kumar S creditlimit 1 000000 enumeration>> cudtomer2 cardnumber: 452199 name tendra P creditlimit: 500000 enumeration>> Customer 3 cardnumber: 4519880 creditlimi: 2000000 name: Nagendra BStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started