CIS 470 LAB 7

week7 x

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

saved

download and pay

tahnks

Codefor GetCourseByCourseID Method:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

import java.util.Scanner;

public class Course1 {

String CourseID;

String CourseTitle;

int CreditHours;

String Description;

String PrerequisiteCourseID;

public static void main(String[] args){

System.out.print(“Enter Course from available courses: CIS 400, CIS150A, CIS150B”);

Scanner input= new Scanner(System.in);

String in=input.nextLine();

int check= GetCourseByCourseID(in);

if (check==0){

System.out.print(“Course does not match”);

}

}

private static int GetCourseByCourseID(String CourseID) {

// TODO Auto-generated method stub

for ( int i = 0; i < course.CourseArray.length; i++ )

{

if ( CourseID.equals(course.CourseArray[i].CourseID ))

{

System.out.println(“Course Matches, here are Course Details”);

System.out.println(“Course ID:”+course.CourseArray[i].CourseID);

System.out.println(“Course Title:”+course.CourseArray[i].CourseTitle);

System.out.println(“Credit Hours:”+course.CourseArray[i].CreditHours);

System.out.println(“Course Description:”+course.CourseArray[i].Description);

System.out.println(“Prerequisite:”+course.CourseArray[i].PrerequisiteCourseID);

}

else {

return 0;

}

}

return 2;

}

Course1(String string, String string2, int i, String string3, String string4){ CourseID = “CIS 400”; CourseTitle = “OO Analysis & Design”; CreditHours = 4; Description = “Important class”; PrerequisiteCourseID = “CIS 110”;

CourseID = “CIS 150A”; CourseTitle = “VB.NET Programming”; CreditHours = 4; Description = “Good Introduction to programming”; PrerequisiteCourseID = “CIS 110”;

CourseID = “CIS 150A”; CourseTitle = “C# Programming with labs”; CreditHours = 4; Description = “Follow-up to CIS 100”; PrerequisiteCourseID = “CIS 110”;

};

}

class course {

static Course1[] CourseArray =

{

new Course1 (“CIS 400”, “OO Analysis & Design”, 4, “Important class”, “CIS 110”),

new Course1 (“CIS 150A” , “VB.NET Programming”, 4, “Good Introduction to programming”, “CIS 100”) ,

new Course1 (“CIS 150B”, “C# Programming with labs”, 4, “Follow-up to CIS 100”, “CIS 100”)

};

}

Explanation of the Code and Unit test Screen Shots:

I have used java language and eclipse software to implement GetCourseByCourseID method. In short my code takes user-input to select one of three available courses. After entering one of the course, the code calls GetCourseByCourseID method in which it checks the user-input course id from course[] Array. If course id matches then my code shows all details of the course otherwise it gives an error that “course does not match”.

Here are the steps given what my code does:

1. When you run code , this message will be seen on the console

2.Input course id.

2. Same as step 2, with different course id

3. Same as step 2, with different course id

4. If wrong course id is written

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER