Question

IN JAVA PLEASE Design and implement an ADT CreditCard that represents a credit card. The data...

IN JAVA PLEASE Design and implement an ADT CreditCard that represents a credit card. The data of the ADT should include Java variables for the customer name, the account number, the next due date, the reward points, and the account balance. The initialization operation should set the data to client-supplied values. Include operations for a credit card charge, a cash advance, a payment, the addition of interest to the balance, and the display of the statistics of the account. Be sure to include a main class which creates an object from your CreditCard class.

I would really apreciate if you can walk me through it and provide me a full soluition of how to implement the code. Everything is stated in the question

Here is what I have so far I get a blank when I run the program...

public interface CreditCard {
public static void main(String[] args) {
}


String name = "";
String accountNumber = "";

String dueDate = "";

int rewardPoints = 0;
double accountBlance = 0.0;

public boolean inputCreditCard(String name, String accountNumber);

public boolean chargeCreditCard(String accountNumber, double charge);

public boolean getCashAdvance(String accountNumber, double advance);

public boolean submitPayment(String accountNumber, double payment);

public double combineIntrest(String accountNumber);

public void displayStatistics(String accountNumber);

}

Homework Answers

Answer #1

import java.util.Scanner;

import javax.swing.*;

import java.awt.*;

import java.net.*;

import java.awt.image.BufferedImage;

import javax.imageio.ImageIO;

import java.io.IOException;

public class creditCard {

private int customerName;

private int accountNumber;

private int dueDate;

private int rewardPoints;

private int accountBalance;

static Scanner input = new Scanner(System.in);

double creditLimit = 500;

int user = 0;

public int getCustomerName() {

    return customerName;

}

public void setCustomerName(int customerName) {

    this.customerName = customerName;

}

public int getAccountNumber() {

return accountNumber;

}

public void setAccountNumber(int accountNumber) {

    this.accountNumber = accountNumber;

}

public int getDueDate() {

    return dueDate;

}

public void setDueDate(int dueDate) {

    this.dueDate = dueDate;

}

public int getRewardPoints() {

    return rewardPoints;

}

public void setRewardPoints(int rewardPoints) {

    this.rewardPoints = rewardPoints;

}

public int getAccountBalance() {

    return accountBalance;

}

public void setAccountBalance(int accountBalance) {

    this.accountBalance = accountBalance;

}

public String charge(float amount) {

    if (amount > creditLimit) {

        System.out.println("You have exceeded your credit card limit and no charge can be made");

    }

    if (creditLimit - amount > 0) {

        System.out.println("You have exceeded your credit card limit and no charge can be made");

    }

    creditLimit = creditLimit - amount;

    System.out.println("A charge of" + amount + "has been made.");

    String charge = "A charge of" + amount + "has been made.";

    return charge;

}

public String advance(float amount) {

    if (amount > creditLimit) {

        System.out.println("You have exceeded your credit card limit and no charge can be made");

    }

    if (creditLimit - amount > 0) {

        System.out.println("You have exceeded your credit card limit and no charge can be made");

    }

    creditLimit = creditLimit - amount;

    System.out.println("You have withdrawn $ " + amount);

    String advance = "You have withdrawn $ " + amount;

    return advance;

}

public String payment(float amount) {

    creditLimit = creditLimit + amount;

    System.out.println("You have a credit limit of $ " + creditLimit);

    String payment = "You have a credit limit of $ " + creditLimit;

    return payment;

}

public String interest() {

    creditLimit = (creditLimit * 0.02) + creditLimit;

    String interest = "An interest of" + creditLimit * 0.02 + "has been added to your balance";

    return interest;

}

public void statistics(String charge, String advance, String payment, String interest) {

    System.out.println(charge);

    System.out.println(advance);

    System.out.println(payment);

    System.out.println(interest);

}

public void showMenu() {

    while (user!= 5) {

        System.out.println("Choose Charge(1) \nAdvance(2) \nPayment(3) \nInterest(4) \ncStatistics(5)");

    user = input.nextInt();

    switch (user) {

        case 1:

            float amount;

            System.out.println("Enter the amount: ");

            amount = input.nextFloat();

            String charge = charge(amount);

            break;

        case 2:

            float withdrawalAmount;

            System.out.println("Enter amount to withdraw: ");

            withdrawalAmount = input.nextFloat();

            String advance = advance(withdrawalAmount);

            break;

        case 3:

            float paymentAmount;

            System.out.println("Enter payment.");

            paymentAmount = input.nextFloat();

            String payment = payment(paymentAmount);

            break;

        case 4:

            String interest = interest();

            break;

        //case 5:

        //statistics(charge, advance, payment, interest);

        //break;

    }

    }

}

public class Runner {

   public static void main(String[] args) {

      CreditCard creditCard= new CreditCard();

      creditCard.showMenu();

      // Do something else

   }

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I am writing code in java to make the design below. :-):-):-):-):-):-)  :-):-):-):-):-):-)  :-):-):-):-):-):-) :-):-):-):-):-):-)  :-):-):-):-):-):-)  :-):-):-):-):-):-) I already have...
I am writing code in java to make the design below. :-):-):-):-):-):-)  :-):-):-):-):-):-)  :-):-):-):-):-):-) :-):-):-):-):-):-)  :-):-):-):-):-):-)  :-):-):-):-):-):-) I already have this much public class Main { int WIDTH = 0; double HEIGHT = 0; public static void drawSmileyFaces() { System.out.println(" :-):-):-):-):-):-)"); } public static void main (String[] args) { for (int WIDTH = 0; WIDTH < 3; WIDTH++ ) { for(double HEIGHT = 0; HEIGHT < 2; HEIGHT++) { drawSmileyFaces(); } } } } I am pretty sure that alot of this is wrong...
Java Program Implement a class called AnimalTrainer. Include the following data types in your class with...
Java Program Implement a class called AnimalTrainer. Include the following data types in your class with the default values denoted by dataType name : defaultValue - String animal : empty string - int lapsRan : 0 - boolean resting : false - boolean eating : false - double energy : 100.00 For the animal property implement both getter/setter methods. For all other properties implement ONLY a getter method Now implement the following constructors: 1. Constructor 1 – accepts a String...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code to initialize the CustomerAccountsDB database table and add a set of customer accounts is provided. Finish the code in these 3 methods in CustomerAccountDB.java to update or query the database: -purchase(double amountOfPurchase) -payment(double amountOfPayment) -getCustomerName() Hint: For getCustomerName(), look at the getAccountBalance() method to see an example of querying data from the database. For the purchase() and payment() methods, look at the addCustomerAccount() method...
How do I make this: public class Country {     private String name;     private double area;     private...
How do I make this: public class Country {     private String name;     private double area;     private int population;     public Country(String name, double area, int population) {         this.name = name;         this.area = area;         this.population = population;     }     public double getPopulationDensity() {         return population / area;     }     public String getName() {         return name;     }     public void setName(String name) {         this.name = name;     }     public double getArea() {         return area;     }     public void setArea(double area) {         this.area = area;     }     public int getPopulation()...
Using Java language.... Polymorphism of Interfaces : Take the Account class from the last chapter and...
Using Java language.... Polymorphism of Interfaces : Take the Account class from the last chapter and make a java program for your bank. However, there is another type of customer that may not have money in the bank and may not in fact have a back account with this bank at all, but may have a loan here. Make another class in the application you are making called CarLoan. Carloan's should have a name, amount owed, a rate, and a...
[Java] I'm not sure how to implement the code. Please check my code at the bottom....
[Java] I'm not sure how to implement the code. Please check my code at the bottom. In this problem you will write several static methods to work with arrays and ArrayLists. Remember that a static method does not work on the instance variables of the class. All the data needed is provided in the parameters. Call the class Util. Notice how the methods are invoked in UtilTester. public static int min(int[] array) gets the minimum value in the array public...
IN JAVA Language- Singly Linked List Implementation Implement a Linked List in your language. Use your...
IN JAVA Language- Singly Linked List Implementation Implement a Linked List in your language. Use your Can class. You need to create a driver that makes several Can objects and places them in alphabetical order in a list. Identify the necessary methods in a List Linked implementation. Look at previous Data Structures (stack or queue) and be sure to include all necessary methods. NOT USE your language's Library List . You will receive zero points. Write a LinkedList class. Include...
What is the output of the following Java program? public class Food {     static int...
What is the output of the following Java program? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { s = flavor; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         pepper.setFlavor("spicy");         System.out.println(pepper.getFlavor());     } } Select one: a. sweet b. 1 c. The program does not compile. d. 2 e. spicy...
Finish the CustomerAccountTransactions program that reads customer accounts receivable data from a file and then applies...
Finish the CustomerAccountTransactions program that reads customer accounts receivable data from a file and then applies a series of transactions to the accounts. Its main() method uses the CustomerAccounts class to manage a collection of CustomerAccount objects: reading customer accounts data & transactions, and obtaining a String showing the customer accounts data after the operations are complete. You will need to complete the readCustomerAccounts () and applyTransactions() methods in the CustomerAccounts class. First, please fill in your name in the...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*;...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*; import javax.swing.*; public class Clicker extends JFrame implements ActionListener {     int count;     JButton button;     Clicker() {         super("Click Me");         button = new JButton(String.valueOf(count));         add(button);         button.addActionListener(this);         setSize(200,100);         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         setVisible(true);     }     public void actionPerformed(ActionEvent e) {         count++;         button.setText(String.valueOf(count));     }     public static void main(String[] args) { new Clicker(); } } a. add(button);...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT