public class Main { public static void main(String[] args) { Scannerinputs = new
ID: 3616962 • Letter: P
Question
public class Main
{
public static void main(String[] args)
{
Scannerinputs = new Scanner(System.in);
Stringch, 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.next();
System.out.println(" Enter number " +(i+1) + " employee's salaryname");
sal = inputs.nextDouble();
arr[i] = new chray();
arr[i].tt(ch, sal);
}
for(inti=0;i<2;i++)
arr[i].est();
}
}
class chray
{
private String stt;
private double dr;
private static int count = 0;
public chray()
{
count +=1;
}
public void tt(String x, double y)
{
stt = x;
dr = y;
}
public void est()
{
System.out.println(" The name is " + stt +" and salary is "+dr+"and ID is " +count);
}
}
Explanation / Answer
please rate - thanks had to make a few other changes, but it works (I think Ihighlighted all the changes--note the commented out code) import java.util.Scanner; public class Main { public static void main(String[] args) { Scannerinputs = new Scanner(System.in); Stringch, 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.