The whats up method is as follows: public String whatsUp() { String status = \"u
ID: 3664560 • Letter: T
Question
The whats up method is as follows:
public String whatsUp() {
String status = "unknown";
int statusNumber = (int)(Math.random() * 4);
switch (statusNumber) {
case 0:
status = "surfing the web.";
break;
case 1:
status = "talking.";
break;
case 2:
status = "reading.";
break;
}
return status;
Explanation / Answer
public class StudentGroup {
public static void main(String[] args) {
if ((args.length == 0) || (args.length % 2) != 0) {
System.out.println("usage java StudentGroup [student names]"); }
else { StudentGroup.makeSomeStudents(args); } }
public static void makeSomeStudents(String[] arguments) {
CSStudent aStudent; int nextId = 0; for (int arg = 0; arg < arguments.length; arg++) {
// Each time through the loop a new CSStudent object is created and its reference is assigned to the aStudent field.
String name = arguments[arg];
String id = String.valueOf(nextId);
nextId++;
aStudent = new CSStudent( name, id);
aStudent.setGrade(100);
// Ask each Student to identify itself
System.out.println(aStudent); }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.