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

  Program that computes and prints the value of 6!/5! using

Write a Java program that computes and prints the  value of 6!/5! using Scanner.

  Write a java program consisting of pigdriver and pig

You will write a Java program consisting of PigDriver and Pig.java, that must Display a welcome message, "Let's Play Pig", Display a blank line and Prompt for the name of the human player.

  Find the errors in the code

You may assume that the following statements precede those in the table below:

  Design and implement a randomqueue

Design and implement a RandomQueue. This is an implementation of the Queue interface in which the remove() operation removes an element that is chosen uniformly at random among all the elements currently in the queue.

  Java test program

Write a Java test program, all your code should be in the main method, that determines what type of organization is indicated by a web address. Your program should allow the user to enter a web address

  Write a program that displays a drawing popular hangman game

Write a program that displays a drawing for the popular hangman game, as shown in Figure 15.32(c). draws a sketch for the hangman game.

  Write a void method that takes as a parameter

Write a Point class. A Point should have the subsequent - Write a void method that takes as a parameter an array of Lines and prints out the location of each intersection. The intersection of any two lines should only be printed once

  List two or three topics of java programming

Explain their importance and give an example of each. List two or three topics you need to work on to better understand their concepts

  Design an object hierarchy

Design an object hierarchy and design your own UML class diagram to reflect the classes and relationship required by your program.

  Write a method that returns the last digit of an integer

Write a method named lastDigit that returns the last digit of an integer - It should work for negative numbers as well.

  Computes the raise and new salary for an employee

Computes the raise and new salary for an employee. Complete the following program to determine the raise and new salary for an employee by adding if ... else statements to compute the raise

  Image to a "black-to-green scale" image

Call a method that will change the image to a "black-to-green scale" image.

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