publicclass assign { public static voidmain(String[] args) { //doublebank_accoun
ID: 3611618 • Letter: P
Question
publicclass assign
{
public static voidmain(String[] args)
{
//doublebank_account[] = newdouble[10];
Scanner keyboard =new Scanner(System.in);
long[] ssn_num =new long[10];
String[] name = new String[10];
double[] cur_bal = new double[10];
String acc_type[] = new String[10];
for(int i = 0; i< 10; ++i)
{
/* System.out.println("Plase enter cust_num: ");
int cust_num = keyboard.nextInt();*/
System.out.println("Please enter your ssn_num: ");
ssn_num[i] = keyboard.nextInt();
System.out.println("please enter yourname: ");
name[i] = keyboard.next();
System.out.println("please enter current balance: ");
cur_bal[i] = keyboard.nextInt();
System.out.println("please enter acc_type: ");
acc_type[i] = keyboard.next();
for(i= 0; i < 10 ;++i)
{
System.out.println("Cust_Number SSN Name Balance Account type");
System.out.println(" [" + i + "] "+ssn_num+" "+name+" " +cur_bal+" " +acc_type);
}
}
}
}
Explanation / Answer
import java.io.*; import java.util.*; public class Assign { public static voidmain(String[] args) { //doublebank_account[] = new double[10]; Scanner keyboard =new Scanner(System.in); long[] ssn_num =new long[10]; String[] name = new String[10]; double[] cur_bal = new double[10]; String acc_type[] = new String[10]; for(int i = 0; i< 10; ++i) { /* System.out.println("Plase enter cust_num: "); int cust_num = keyboard.nextInt();*/ System.out.println("Please enter your ssn_num: "); ssn_num[i] = keyboard.nextLong(); System.out.println("please enter yourname: "); name[i] = keyboard.next(); System.out.println("please enter current balance: "); cur_bal[i] = keyboard.nextDouble(); System.out.println("please enter acc_type: "); acc_type[i] = keyboard.next(); } System.out.println(" Cust_Number SSN Name Balance Account type"); for(int j = 0; j< 10 ; j++) { System.out.println(" [" + (j+1) + "] "+ssn_num[j]+" "+name[j]+" " +cur_bal[j]+" " +acc_type[j]); } } }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.