Introduction to Computing - Java - Assignment 7 Solutions | CSC 116, Assignments of Java Programming

Material Type: Assignment; Class: Introduction to Computing - Java; Subject: Computer Science; University: North Carolina State University; Term: Spring 2005;

Typology: Assignments

Pre 2010

Uploaded on 03/10/2009

koofers-user-3xy
koofers-user-3xy ๐Ÿ‡บ๐Ÿ‡ธ

5

(2)

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
๎˜๎˜‚๎˜๎˜ƒ๎˜„๎˜„๎˜…๎˜ƒ๎˜†๎˜ƒ๎˜‡๎˜‡๎˜ˆ๎˜ƒ๎˜‰๎˜Š๎˜‹๎˜Œ๎˜๎˜Ž๎˜๎˜๎˜ƒ๎˜๎˜‘๎˜’๎˜“๎˜Œ๎˜”๎˜๎˜’๎˜ƒ๎˜•๎˜ƒ๎˜–๎˜ƒ
๎˜ƒ
๎˜—๎˜Ž๎˜˜๎˜’๎˜™๎˜ƒ๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜‚๎˜›๎˜๎˜œ๎˜๎˜”๎˜›๎˜Š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜ƒ๎˜ž๎˜Š๎˜”๎˜๎˜Ÿ๎˜ƒ๎˜‰ ๎˜™๎˜ƒ๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜ƒ!๎˜Ž"๎˜™๎˜ƒ๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜š๎˜ƒ
๎˜ƒ
#๎˜’๎˜๎˜›$๎˜ƒ๎˜%๎˜Ž๎˜๎˜ƒ๎˜”๎˜๎˜ƒ๎˜Ž๎˜ƒ๎˜Œ๎˜๎˜Ž๎˜๎˜๎˜ƒ๎˜Œ๎˜Ž๎˜๎˜๎˜’&๎˜ƒ๎˜๎˜‚๎˜๎˜„๎˜„๎˜…๎˜‚๎˜’๎˜Œ๎˜๎˜”๎˜›๎˜Š๎˜‡๎˜‡๎˜ˆ'๎˜ƒ๎˜ƒ(%๎˜’๎˜ƒ๎˜‚๎˜๎˜œ&๎˜’๎˜Š๎˜๎˜ƒ๎˜Œ๎˜๎˜Ž๎˜๎˜๎˜ƒ๎˜”๎˜๎˜ƒ&๎˜”๎˜)๎˜๎˜Ž๎˜Ÿ๎˜’&๎˜ƒ๎˜›๎˜Š๎˜ƒ๎˜%๎˜’๎˜ƒ)๎˜“๎˜›*๎˜’๎˜Œ๎˜๎˜›๎˜“'๎˜ƒ๎˜ƒ+๎˜›๎˜œ๎˜ƒ
๎˜Ž๎˜“๎˜’๎˜ƒ,๎˜›๎˜”๎˜Š,๎˜ƒ๎˜๎˜›๎˜ƒ๎˜Œ๎˜“๎˜’๎˜Ž๎˜๎˜’๎˜ƒ๎˜Ž๎˜ƒ)๎˜Ž๎˜“๎˜๎˜”๎˜Ž๎˜๎˜๎˜Ÿ๎˜ƒ-๎˜”๎˜๎˜๎˜’&๎˜ƒ๎˜Ž๎˜“๎˜“๎˜Ž๎˜Ÿ๎˜ƒ๎˜›-๎˜ƒ๎˜‚๎˜๎˜œ&๎˜’๎˜Š๎˜๎˜๎˜ƒ-๎˜›๎˜“๎˜ƒ๎˜%๎˜’๎˜ƒ๎˜๎˜‚๎˜๎˜„๎˜„๎˜…๎˜‚๎˜’๎˜Œ๎˜๎˜”๎˜›๎˜Š๎˜‡๎˜‡๎˜ˆ๎˜ƒ๎˜Œ๎˜๎˜Ž๎˜๎˜'๎˜ƒ๎˜ƒ(%๎˜’๎˜“๎˜’๎˜ƒ๎˜Ž๎˜“๎˜’๎˜ƒ./๎˜ƒ
๎˜๎˜๎˜œ&๎˜’๎˜Š๎˜๎˜๎˜ƒ๎˜”๎˜Š๎˜ƒ๎˜%๎˜’๎˜ƒ๎˜Œ๎˜๎˜Ž๎˜๎˜'๎˜ƒ๎˜ƒ0๎˜๎˜’๎˜Ž๎˜๎˜’๎˜ƒ๎˜Œ๎˜›๎˜˜)๎˜๎˜’๎˜๎˜’๎˜ƒ๎˜%๎˜’๎˜ƒ๎˜Ž&&๎˜‚๎˜๎˜œ&๎˜’๎˜Š๎˜๎˜ƒ๎˜˜๎˜’๎˜%๎˜›&'๎˜ƒ๎˜ƒ๎˜‰๎˜Š๎˜ƒ๎˜%๎˜’๎˜ƒ๎˜˜๎˜Ž๎˜”๎˜Š๎˜ƒ๎˜˜๎˜’๎˜%๎˜›&๎˜ƒ๎˜›-๎˜ƒ๎˜%๎˜’๎˜ƒ
๎˜๎˜‚๎˜๎˜„๎˜„๎˜…๎˜‚๎˜’๎˜Œ๎˜๎˜”๎˜›๎˜Š๎˜‡๎˜‡๎˜ˆ๎˜ƒ๎˜Œ๎˜๎˜Ž๎˜๎˜๎˜ƒ)๎˜๎˜’๎˜Ž๎˜๎˜’๎˜ƒ๎˜Ž&&๎˜ƒ๎˜Ÿ๎˜›๎˜œ๎˜“๎˜๎˜’๎˜-๎˜ƒ๎˜Ž๎˜๎˜ƒ๎˜%๎˜’๎˜ƒ-๎˜”๎˜“๎˜๎˜๎˜ƒ๎˜๎˜๎˜œ&๎˜’๎˜Š๎˜๎˜ƒ๎˜”๎˜Š๎˜ƒ๎˜%๎˜’๎˜ƒ๎˜Œ๎˜๎˜Ž๎˜๎˜๎˜ƒ๎˜œ๎˜๎˜”๎˜Š,๎˜ƒ๎˜%๎˜’๎˜ƒ๎˜Ž&&๎˜‚๎˜๎˜œ&๎˜’๎˜Š๎˜๎˜ƒ
๎˜˜๎˜’๎˜%๎˜›&'๎˜
๎˜
๎˜‚๎˜ƒ๎˜ƒ๎˜
๎˜๎˜ƒ๎˜๎˜„๎˜…๎˜†๎˜‡๎˜ˆ๎˜‰๎˜Š๎˜‰๎˜๎˜Š๎˜‹๎˜Œ๎˜๎˜๎˜Ž๎˜ˆ๎˜๎˜๎˜๎˜๎˜
๎˜๎˜ƒ๎˜‚๎˜
๎˜‡๎˜‘๎˜’๎˜ˆ๎˜Œ๎˜Ž๎˜๎˜Ž๎˜ˆ๎˜๎˜๎˜๎˜๎˜„๎˜“๎˜„๎˜”๎˜”๎˜•๎˜“๎˜‰๎˜Ž๎˜Š๎˜Œ๎˜…๎˜–๎˜—๎˜—๎˜˜๎˜๎˜™๎˜
๎˜ ๎˜‚๎˜‚๎˜š๎˜‰๎˜Ž๎˜ˆ๎˜๎˜›๎˜‰๎˜๎˜๎˜–๎˜๎˜๎˜›๎˜›๎˜๎˜œ๎˜๎˜…๎˜๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜๎˜๎˜–๎˜š๎˜๎˜๎˜๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜›๎˜
๎˜ ๎˜
๎˜ ๎˜‡๎˜›๎˜Œ๎˜ž๎˜๎˜Š๎˜‰๎˜๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜Ÿ ๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜!๎˜
๎˜
๎˜ ๎˜‡๎˜›๎˜Œ๎˜ž๎˜๎˜Š๎˜‰๎˜๎˜Œ๎˜–๎˜Š๎˜๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜›!๎˜
๎˜๎˜๎˜
๎˜ ๎˜‡๎˜‘๎˜’๎˜ˆ๎˜Œ๎˜Ž๎˜๎˜„๎˜“๎˜„๎˜”๎˜”๎˜•๎˜“๎˜‰๎˜Ž๎˜Š๎˜Œ๎˜…๎˜–๎˜—๎˜—๎˜˜"#๎˜๎˜™๎˜
๎˜ ๎˜ ๎˜‚๎˜‚๎˜Œ๎˜–๎˜Œ๎˜Š๎˜Œ๎˜ˆ๎˜Œ$๎˜‰๎˜๎˜œ๎˜…๎˜‘๎˜›๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜๎˜›๎˜›๎˜๎˜œ๎˜๎˜๎˜–๎˜š๎˜๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜›๎˜
๎˜
๎˜ ๎˜ ๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜%๎˜๎˜–๎˜‰&๎˜๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜Ÿ'( !๎˜๎˜ ๎˜
๎˜๎˜๎˜
๎˜ ๎˜ ๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜›๎˜%๎˜๎˜—!๎˜
๎˜ )๎˜
๎˜
๎˜ ๎˜‡๎˜‘๎˜’๎˜ˆ๎˜Œ๎˜Ž๎˜๎˜ž๎˜…๎˜Œ๎˜š๎˜๎˜๎˜š๎˜š๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š"๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜–๎˜‰&๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š#๎˜๎˜™๎˜
๎˜ ๎˜ ๎˜‚๎˜‚*๎˜‰๎˜๎˜Š๎˜๎˜Š๎˜…๎˜๎˜๎˜‰๎˜‰๎˜๎˜Œ๎˜๎˜๎˜Š๎˜‹๎˜‰๎˜›๎˜‰๎˜๎˜Œ๎˜๎˜๎˜›๎˜…๎˜…๎˜†๎˜๎˜Œ๎˜–๎˜๎˜Š๎˜‹๎˜‰๎˜๎˜๎˜›๎˜›๎˜๎˜œ๎˜
๎˜
๎˜ ๎˜ ๎˜Œ๎˜"๎˜๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜›๎˜+๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜,๎˜ˆ๎˜‰๎˜–-๎˜Š๎˜‹๎˜#๎˜
๎˜ ๎˜ ๎˜ ๎˜‚๎˜‚๎˜๎˜š๎˜š๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜Š๎˜…๎˜๎˜๎˜›๎˜›๎˜๎˜œ๎˜๎˜
๎˜
๎˜ ๎˜ ๎˜ ๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜Ÿ๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜› ๎˜%๎˜๎˜–๎˜‰&๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š!๎˜
๎˜
๎˜ ๎˜Ž๎˜…๎˜‘๎˜–๎˜Š๎˜‰๎˜›..!๎˜
)๎˜
๎˜ )๎˜
๎˜ ๎˜
๎˜ ๎˜‡๎˜‘๎˜’๎˜ˆ๎˜Œ๎˜Ž๎˜๎˜๎˜Š๎˜๎˜Š๎˜Œ๎˜Ž๎˜๎˜ž๎˜…๎˜Œ๎˜š๎˜๎˜†๎˜๎˜Œ๎˜–"๎˜“๎˜Š๎˜›๎˜Œ๎˜–-๎˜๎˜Ÿ ๎˜๎˜๎˜›-๎˜#๎˜๎˜™๎˜
๎˜‚๎˜‚๎˜„๎˜›๎˜‰๎˜๎˜Š๎˜‰๎˜๎˜๎˜๎˜–๎˜‰&๎˜๎˜„๎˜“๎˜„๎˜”๎˜”๎˜•๎˜“๎˜‰๎˜Ž๎˜Š๎˜Œ๎˜…๎˜–๎˜—๎˜—๎˜˜๎˜/๎˜’0๎˜‰๎˜Ž๎˜Š๎˜
๎˜
๎˜„๎˜“๎˜„๎˜”๎˜”๎˜•๎˜“๎˜‰๎˜Ž๎˜Š๎˜Œ๎˜…๎˜–๎˜—๎˜—๎˜˜๎˜๎˜†๎˜œ๎˜„๎˜ˆ๎˜๎˜๎˜๎˜%๎˜๎˜–๎˜‰&๎˜๎˜„๎˜“๎˜„๎˜”๎˜”๎˜•๎˜“๎˜‰๎˜Ž๎˜Š๎˜Œ๎˜…๎˜–๎˜—๎˜—๎˜˜"#!๎˜
๎˜
๎˜‚๎˜‚๎˜„๎˜›๎˜‰๎˜๎˜Š๎˜‰๎˜๎˜๎˜๎˜–๎˜‰&๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜
๎˜
๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜†๎˜‰๎˜%๎˜๎˜–๎˜‰&๎˜๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š"1๎˜“๎˜๎˜›๎˜๎˜‹23๎˜๎˜˜๎˜—๎˜”#!๎˜
๎˜
๎˜‚๎˜‚4๎˜š๎˜š๎˜๎˜๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š๎˜๎˜Š๎˜…๎˜๎˜Š๎˜‹๎˜‰๎˜๎˜๎˜›๎˜›๎˜๎˜œ๎˜
๎˜
๎˜ ๎˜†๎˜œ๎˜„๎˜ˆ๎˜๎˜๎˜,๎˜๎˜š๎˜š๎˜“๎˜Š๎˜‘๎˜š๎˜‰๎˜–๎˜Š"๎˜†๎˜‰#!๎˜
)๎˜
)๎˜

Partial preview of the text

Download Introduction to Computing - Java - Assignment 7 Solutions | CSC 116 and more Assignments Java Programming in PDF only on Docsity!

CSC 116 โ€” 002 In-class Exercise #7 Name: Solution Unity ID: Lab: Below that is a class called CSC116Section002. The Student class is displayed on the projector. You are going to create a partially filled array of Students for the CSC116Section002 class. There are 95 students in the class. Please complete the addStudent method. In the main method of the CSC116Section002 class please add yourself as the first student in the class using the addStudent method. [** * Complete this class! */ public class CSC116Section002 { //declare an array of students and a counter private Student [] students; private int counter; public CSC116Section002() { //initilize your student array and counter students = new Student[95]; counter = 0; } public void addStudent (Student newStudent) { //Test to see if there is room in the array if( counter < students.length ) //add student to array students [counter] = newStudent; countert++; } public static void main(String [] args) { //Create a new CSC116Section002 Object CScl1l6Section002 myClass = new CSC116Section002(); //Create a new student Student me = new Student (โ€œSarahโ€, 201); //Add student to the array myClass.addStudent (me) ;