Starting from:

$15

Lab-6-Using-Arrays-with-Methods

1) Create a class called CustomerLister with a main method that instantiates an array of String objects called customerName. The array should have room for five String objects. Use an initializer list to put the following names into the array:

Cathy
Ben
Jorge
Wanda
Freddie

Print the array of names using an enhanced for loop.

2) Replace the enhanced for loop in part 1 by a standard for loop to print the customer names.
3) Create a second double array called customerBalance in the main method. Allow room for five customer balances, each stored as a double. Add a loop that prompts the user with each customer name in order to enter a balance for that customer. Read the keyboard input with a Scanner object. Use the following balances for the input:

100.00
234.56
2.49
32.32
400.00

After all the balances have been entered, print out each customer and his/her balance.

More products