packagearraysofobjects; import java.util.Scanner; public class Main { public sta
ID: 3616957 • Letter: P
Question
packagearraysofobjects;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scannerinputs = new Scanner(System.in);
String ch,sch, sc;
doublesal;
chray arr[]= new chray[2];
chray ary =new chray();
for(inti=0;i<2;i++)
{
System.out.println(" Enter number " +(i+1) +" employee's firstname");
ch = inputs.nextLine();
System.out.println(" Enter number " +(i+1) + " employee's salaryname");
sal = inputs.nextDouble();
arr[i] = new chray();
arr[i].tt(ch, sal);
}
}
}
class chray
{
private String stt;
private double dr;
public chray()
{
tt(stt, dr);
}
public void tt(String x, double y)
{
stt = x;
dr = y;
}
public void est()
{
System.out.println(" These are the values" + stt + dr);
}
}
Explanation / Answer
please rate - thanks change nextLine to next -- you're not inputting any blank spaces inthe input import java.util.Scanner; public class Main { public static void main(String[] args) { Scannerinputs = new Scanner(System.in); String ch,sch, sc; doublesal; chray arr[]= new chray[2]; chray ary =new chray(); for(inti=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.