Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you may code the class , intsructions are in green , the parameters(@param) and the return type (@return) are given in green comment parts,everything is

you may code the class , intsructions are in green , the parameters(@param) and the return type (@return) are given in green comment parts,everything is given in green to do as comments
image text in transcribed
image text in transcribed
image text in transcribed
The Classroom Class 1 public class MyProgram extends Console Program 2-1 public void run() //Create a Classroom object with 3 rows x 6 columns of students Classroon roomi = new Classroom("Mr. Jugglecats", 3, 6); //Print the classroon object //System.out.println(rooni); //room. addName("Taha"); //roomi.addName("Varun"); 1/room1.addName("Ramsey"); //room1.addName("Azzam"); //room1.addName("Jiya"); 1/Print the classroom object //System.out.println(room); 3 4. 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3e 31 32 33 34 35 36 37 38 39 48 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 6e 61 //rooni.addName("Josh"); //room1.addName("Armaan"); //roomi.addName("Marian"); V/roomi.addName("A1"); //roomi. addName("Max"); //rooni.addName("Davide"); //room.addName("Zoe") 7/rooni.addName("Shrey"); 1/rooni.addName("Sharif"); //room1.addName("Yassine" //rooms.addName("Parth"); //room. addName("Adam"); I/room1.addName("Rayane"); //Print the Classroon object 1/System.out.println(rooni); //Try removing names from the classroom // 1/System.out.println("Davide removed: room.removeName("Davide")); 1/System.out.println("Marian removed: + room.removeName("Maria")); 1/System.out.println("Davide removed: + roon.removeName "Davide")); 1/System.out.println("Corky removed: + rooms.removeName("Corky")); // Print the classroon object I/System.out.println(); 1/System.out.println(rooni): 1/Swap some of the names ONLY 1f both names exist! 1/rooni. swapnames("Taha", "Zoe"); 1/roont.swapanes("John","aesey"): 1/rooni. Swapanes("Zoe", "Adam"); 1/Print the Classroos object 1/System.out.println(room); 1/Add names into the first empty slots 1/roon.add("George"); /room. addName("Lizzy") Wroom. addName("Thomas); //Print the classroos object 7/System.out.println(room); Yend run Ylend class 63 65 66 67 65 The Classroom Class 1 public class Classroom 2.1 3 //Fields 4 1/One String to hold the teacher's name 5 I/A String[i] pointer for the seating chart 6 // 7 private String teacher; 8 private String[][] seatchart; //Currently pointing to nothing 19 //Constructor 11 //Sets the two fields 12 //The String[][] must be pointed to a string(1) with dimensions "rows' and 'cols 13 I/NOTE: The String[now exists, but with null pointers. 14 //-- 15 public Classroom (String teacher, int rows, int cols) 16. 17 18 ) 19 20 // 21 7/PUBLIC METHODS 22 17: 23 24 1/Method: addNane 25 W/@paran: String (the name to add) 26 1/@return: void 27 1/Put the name in the seating chart in the first slot available (1.e. null) 28 //If the seating chart is full i.e. no null pointers), do nothing 29 30 31 //Method: renoveName 32 1/eparam: String (the name to remove) 33 77@return: boolean 34 //If the name exists in the data structure, replace it with 'null and return true. 35 // If the name does NOT exist, do nothing except return false. 36 37 38 //Method: SwapNames 39 1/param: String the first name) 40 //param: String (the second name) 41 /return: voia 42 //Swap the two names in the data structure. 43 //If one, or both, of the names do NOT exist, do nothing. 44 45 46 //Method: private method getSeatingChart() called by toString() 47 7/@parant none 48 //return: String //Return a String represenation of the seating chart. 50 1/For null pointers, replace 'null with "-empty-" 51 //Use a tab between names on the same row. 52 53 54 //Method: @Override toString() -- DONE FOR YOU 55 //return: String 56 I/Two things to print, like this example: 57 7/1. Teacher: Ms. Johnston 1/2. Call this.getSeating Chart() to get the chart (a String) 59 BOverride public String tostring) 52 String 5 - "Teacher :. this.teacher 63 ++ " " this.getSeating Chart(); 64 returns 65 3 65 67 //end elass 61 61 - c 12 points Status: Not Submitted IMPLEMENT THE METHODS IN THE Classroom Class You may call private helper methods if you need them Leave empty slots in the seating chart as 'null' please Do not fill them with empty"... that is just what it looks like when printed! Teacher: Mr. Jugglecats -empty. -empty--empty--empty--empty empty. -empty--empty--empty--empty- empty- empty. -empty--empty. -empty--empty. -empty--empty- Teacher: Mr. Jugglecats Taha Varun Ramsey Azzam Jiya -empty- -empty- -empty. -empty- empty- -empty. -empty- -empty--empty--empty--empty. -empty--empty. Josh Teacher: Mr. Jugglecats Taha Varun Ransey Azzam 21ya Armaan Marian Al Max Davide Zoe Shrey Sharif Yassine Parth Adam Rayane Davide removed: true Marian removed: true Davide removed: false Corky removed: false Josh Teacher: Mr. Dugglecats Taha Varun Ramsey Azzam Jiya Arnaan empty- Al Max-empty- Zoe Shrey Sharif Yassine Parth Adan Rayane Teacher: Mr. Jugalecats Adam Varun Ramsey Art Jiya Josh Armaan -empty- Al Max-empty. Taha Shrey Sharif Yassine Parth Zoe Rayane Teacher: Mr. Jusclecats Adam Varun Ramsey Azza Armaan George Al Max Litry Shrey Sharif Yassine Parth Jiya Josh Tahs Zoe Rayane

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago