Check09D - if...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import type.lib.Student; import; import java.util.Scanner; i public class Check09D { public static void main(String[] args) { PrintStream out = System.out; Student randomStudent = Student.getRandom(); out.println("Student Name: " + randomStudent.getName()); out.println("Student ID: " + randomStudent.getID()); out.printf("Student GPA: %.1f%n%n", randomStudent.getGpa()); for (String course : randomStudent) { out.println(course + "\t" + randomStudent.getCourseGrade(course)); } out.println("Do you think this is a SE student?"); out.print("Enter y or n . .. "); String askMe = new Scanner(;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if ((!randomStudent.toString().startsWith("SE") && askMe.contains("N")) || (randomStudent.toString().startsWith("SE") && askMe.contains("Y"))) { out.println("You are right!"); } //out.printf("This is in fact a %s", randomStudent.toString().substring(0, 9)); if (randomStudent.toString().startsWith("SE")) { out.println("SEstudent"); } else if (randomStudent.toString().startsWith("IT")) { out.println("ITstudent"); } else if (randomStudent.toString().startsWith("C")) { out.println("CSEstudent"); } } }...
View Full Document

This note was uploaded on 09/16/2011 for the course CSE CSE 1020 taught by Professor Burton,ma during the Fall '10 term at York University.

Ask a homework question - tutors are online