in JAVA Any help would be greatly appreciated Even a step by
in JAVA. Any help would be greatly appreciated. Even a step by step list explaining how to do this would be great too.
Ocean County College Ocean Connect × \\ Lab 6-Using Arrays × // D Microsoft Word _ Lab 6- \\ Files . D exam2practice.pdf x-G Suppose You Push YourX \\e Find The Indefinite Intec × C file:///C/Users/debra/Downloads/Lab%206%20-%20using%20Arrays%20with%20Methods%20(1).pdf Microsoft Word-Lab 6-Using Arrays with Methods.docx 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 String objects. Use an initializer list to put the following names into the array array should have room for five 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 4) Create a BankAccount class completing the following starter code public class BankAccount ( private String customerName; private double customerBalance; public BankAccount (String name, double balance) / Add code to initialize customerName and customerBalance public String getCustomerName() { // Add code to return customerName public double getCustomerBalance() // Add code to return customerBalance 10:01 PM 11/14/2016 6 Ask me anythingSolution
Answer (1)
package chegg;
public class CustomerLister {
public static void main(String[] args) {
/* create String array object with lenght 5*/
String[] customerName = new String[5];
/*initialize customer name as given in question*/
customerName[0]=\"Cathy\";
customerName[1]=\"Ben\";
customerName[2]=\"Jorge\";
customerName[3]=\"Wanda\";
customerName[4]=\"Freddie\";
/*Enhanced for loop that print all customer name*/
for (String name : customerName) {
System.out.println(\"Customer Name is : \" + name);
}
}
}// end of class
--------------------
output sample :-
Customer Name is : Cathy
Customer Name is : Ben
Customer Name is : Jorge
Customer Name is : Wanda
Customer Name is : Freddie
--------------------------------------------------------------------------------------------------------------
Answer (2)
package chegg;
public class CustomerLister {
public static void main(String[] args) {
/* create String array object with lenght 5*/
String[] customerName = new String[5];
/*initialize customer name as given in question*/
customerName[0]=\"Cathy\";
customerName[1]=\"Ben\";
customerName[2]=\"Jorge\";
customerName[3]=\"Wanda\";
customerName[4]=\"Freddie\";
/*Standard for loop to print customer name*/
for (int i=0;i< customerName.length;i++){
System.out.println(\"Customer Name is : \" + customerName[i]);
}
}
}
-----------------
output sample:-
Customer Name is : Cathy
Customer Name is : Ben
Customer Name is : Jorge
Customer Name is : Wanda
Customer Name is : Freddie
----------------------------------------------------------------------------------------
Answer (3)
package chegg;
import java.util.Scanner;
public class CustomerLister {
public static void main(String[] args) {
/* create String array object with lenght 5*/
String[] customerName = new String[5];
Double[] customerBalance = new Double[5];
Scanner sc=new Scanner(System.in);
/*initialize customer name as given in question*/
customerName[0]=\"Cathy\";
customerName[1]=\"Ben\";
customerName[2]=\"Jorge\";
customerName[3]=\"Wanda\";
customerName[4]=\"Freddie\";
/*Standard for loop to read customer balance from user*/
for (int i=0;i< customerName.length;i++){
System.out.print(\"Enter Balance for Customer \" + customerName[i] + \" : \");
customerBalance[i]=sc.nextDouble();
}
/*Standard for loop to print customer name and customer balance*/
System.out.println(\"Each Customer and his/her balance\");
for (int i=0;i< customerName.length;i++){
System.out.println( customerName[i]+ \" : \"+customerBalance[i]);
}
}
}
---------------------
output sample:-
Enter Balance for Customer Cathy : 100.00
Enter Balance for Customer Ben : 234.56
Enter Balance for Customer Jorge : 2.49
Enter Balance for Customer Wanda : 32.32
Enter Balance for Customer Freddie : 400.00
Each Customer and his/her balance
Cathy : 100.0
Ben : 234.56
Jorge : 2.49
Wanda : 32.32
Freddie : 400.0
--------------------------------------------------------------------------------------
Answer (4)
package chegg;
public class BankAccount {
private String customerName;
private Double customerBalance;
public BankAccount(String name, Double balance)
{
this.customerName=name;
this.customerBalance=balance;
}
public String getCustomerName() {
/* return customer name*/
return customerName;
}
public Double getCustomerBalance() {
/* return customer balance*/
return customerBalance;
}
}
---------------------------------------------------------------------------------------------
If you have any query, please feel free to ask.
Thanks a lot.



