Create an array of creditcard objects

Assignment Help JAVA Programming
Reference no: EM131596498

Programming and Logic I

Project: Credit Card

Your CreditCard class should contain three data fields and methods to set, get and manipulate these fields. In this project, you will create an array of CreditCard objects, populate and display the values. You will not be changing your CreditCard class, but you will have to submit it.

Files to Submit:

CreditCard.java
TestCreditCard.java

TestCreditCard.java

createAccountArrayFromFile()
Create a method called createAccountArrayFromFile. (This is a long name, I realize, but it is descriptive.) This method will create and return an array of CreditCard objects.

Open the file, accounts.txt, for reading. Hard code this file name into your program. The file will contain three lines for each account: an account number, account name, and balance, and has data for 10 accounts. The file I will use to test your program will also have data for 10 accounts but the accounts will contain different data.

Create the array. The size will be 10 and this can be hard coded. Although we are reading this information from a file and it would be more usefulto simply add objects as we go along, an array needs a size when it is created. (The ArrayList class does not, and is preferable in this respect.)

Create a loop and iterate through the file, creating elements of the CreditCard array. If you didn't know how much data was stored in the file, you would use a while loop, but since you know it will contain exactly 10 accounts, you can use a while loop or for loop.

Finally, the method must return the array.

printCreditCardArray()
Create a void method called printCreditCardArrray that takes one parameter, a CreditCard array. Loop through the array and print the values using the CreditCard object's printAccount method.

main()
Empty the main method. Create a CreditCardarray and make it equal to thecreateAccountArrayFromFile method call. The call theprintCreditCardArray method and send it one argument: the CreditCard array.
Notes:
- You can append numbers to your files if you want to preserve old files - for example, CreditCard3.java, TestCreditCard3.java. Just make sure you are using the correct class name in your TestCreditCard program.
- If you use a while loop to iterate through the file, you will need an int variable to act as an index for the array. Make sure to initialize this variable to 0 before the loop begins and increment it within the loop.
- You may enconter the nextLine issue as you read through the file. This occurs when you read a number using nextInt or nextDouble and then use the nextLine method. This is remedied by using a "dummy"nextLine call in between nextInt and nextLine.

Attachment:- Code.rar

Reference no: EM131596498

Questions Cloud

Prepare the journal entries for ayayai : Prepare the journal entries for Ayayai for the following dates. Investment in call option on Counting Crows shares on August 15, 2016
Consumers realize resulting from increased competition : Two of the benefits that consumers realize resulting from increased competition are lower prices and improved product quality.
Prepare a cost of quality report : Prepare a cost of quality report that provides information for management in an informative way
Ensure that every function of every application works : Ensure that every function of every application of the computer system works and the system meets the functional requirements and the RFP specifications.
Create an array of creditcard objects : Create an array of CreditCard objects, populate and display the values. You will not be changing your CreditCard class, but you will have to submit it
Economic profit in the short-run and in the long run : 1. In a monopolistically competitive market, can firms earn economic profit in the short-run and in the long run? Explain.
What is the percentage return to the management : What was the initial cost to Mitchell Labs to go private? What is the percentage return to the management of Mitchell Labs from the restructuring?
What is the balance is allowance for doubtful accounts : If the percentage of receivables method is used, what is the balance is Allowance for Doubtful Accounts after any adjustment is made
Luke walkskyer wants to buy your mortgage : c. Luke Walkskyer wants to buy your mortgage.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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