Problem Description Hello! Please make sure to read all parts of this document carefully. You will...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem Description Hello! Please make sure to read all parts of this document carefully. You will be writing a Classroom Organizer to help with seating students. In this assignment, you'll be using your knowledge of iteration and arrays to create a program that allows tracking and editing the location of students in a classroom. To do this, you will create and turn in a ClassroomOrganizer.java file that runs code in a main method. You are allowed to create helper methods (and we recommend you do), but only the main is required. Solution Description You will write a single file, ClassroomOrganizer.java. You must use all the kinds of loops explored in L7- L8 at least once. ClassroomOrganizer.java Classroom Organizer will simulate a terminal prompt where the user can input commands to edit and print the locations of students. Before describing the commands, we will explore the format of the classroom in the output. Here's an example of the output formatting for a classroom with 2 rows and 4 columns, with some seats assigned: # DE # ABC # ####### # ] # # KLMNO ############ ### # FGHI # ######## # # ######## You can observe that the output formatting has the following features: At the top and bottom, as well as between each classroom row, there's a row of #. On the left and right, as well as between each classroom column, there's a column for #. The length (in number of characters) of each column is determined by the student who has the longest name. It should fit that name, as well as one space to the left and one to the right. Columns always have a length of at least 3, even if no student is seated anywhere in that column. Names are always centered. If it's impossible to center it exactly (like DE), one more space will be added to the right of the name in the output. ClassroomOrganizer will receive from console arguments two integers representing the number of rows and columns, which describes the layout of the classroom. You will use a String 2D array to keep track of who is seated at each seat. The top row is 0, and the left-most column is 0. For example, java ClassroomOrganizer 2 4 would create a layout like the one in the output formatting. In the example o Student ABC: row 0, column 0 Student DE: row 0, column 2 o o Student FGHI: row 0, column 3 o Student J: row 1, column 0 o Student KLMNO: row 1, column 2 If any of the rows' or columns' inputs are invalid (note: there must be at least one seat in the classroom), the program will print an error message "Invalid classroom size" and finish the program. o Note: while the inputs aren't always valid, they are guaranteed to be two integers. This will also apply to all inputs in the program: the input format will always be valid, but the integer values may not be. Tip: You can use Integer.parseInt, which is the int-equivalent to the Double.parseDouble from lecture. Until the program finishes, the program will ask for a command by printing "> " and allowing the user to input a command through console input in the same line. The program will execute the command (or print an error message), and, if the program didn't finish, ask for a command again. If the command is quit, the program will finish without further output. If the command is print, the program should print the current classroom seating assignment, following the output formatting described above. If the command is go: o A go command always has the following format (without the brackets): go to [row] [column] [name] (name doesn't have spaces) o It will place a student (who can be in another seat or outside the classroom) into the seat at the location of the appropriate row or column o If it fails, it will print one of the following errors: If the student was already there, the error is: "[name] is already there" If another student was there, the error is: "[other student name] is there" If the location is invalid, the error is: "Invalid location" o If it succeeds, and the classroom isn't full, it will print nothing. o If it succeeds and the classroom is now full, it will print "Classroom is full", followed by the classroom seats (same output as print), and finish the program. If the command is move: o A move command is always one of the following (without the brackets): move up [name], move down [name], move left [name], move right [name] (name doesn't have spaces) Recommended Methods While not required, we recommend you use helper methods (methods that "support" main or other methods) to structure your program. We provide the following list of methods (all of which should be static methods, like those in L9). This is an example of methods that you could write (but feel free to structure your program differently!). o It will move a student who is in the classroom into a seat relative to the current location of the student, based on their current location (for example, move up would move a student in location 10 to location 0 0) o If it succeeds (the student location changed), it prints nothing. Otherwise, it will print one of the following errors: If the student is not in the classroom, the error is "[name] is not in the classroom" If another student was in the new location, the error is "[other student name] is there" If the new location is invalid, the error is "Invalid location" boolean isClassroom Full (String[][] classroom) void handleGo (String[][] classroom, int row, int column, String name) void handleMove (String[][] classroom, String direction, String name) void printClassroom (String[] [] classroom) int[] calculateColumn Lengths (String[][] classroom) void printSeparator Row(int length) void printClassroom Row (String[] classroomRow, int[] columnLengths) String centered (String name, int columnLength) Example Output 1 - User Input is Bolded. Your program should look exactly like this. java command: java ClassroomOrganizer 21 > print ***** # > go to 1 0 Alice > print ********* # # Alice # **** > go to 0 0 Bob classroom is full ********* # Bob # # Alice # *** Example Output 2-User Input is Bolded. Your program should look exactly like this. java command: java ClassroomOrganizer 44 > go to 1 1 Alice > go to 2 1 Bob > go to 1 2 Charlie > go to 2 2 Dave > print ###* # # ########## # ###* # #### # # # Alice # Charlie # # # # Bob # Dave # # > move left Bob > move down Alice # > move right Dave > move up Charlie > print ##: # # # # # ## # Bob # Alice # #### # # # Charlie # # # > move right Dave Invalid location > move left Alice Bob is there > quit # # # # # # # # Dave # ### # Rubric [100] ClassroomOrganizer.java [90] Several scenarios (not necessarily all weighted equally). Each scenario is scored all- or-nothing, depending on whether the input/output matches the solution. . [10] Other checks o [2.5] x 4: Uses each kind of loop at least once. We reserve the right to adjust the rubric, but this is typically only done for correcting mistakes. Allowed Imports To prevent trivialization of the assignment, you are only allowed to import java.util.Scanner. You are not allowed to import any other classes or packages. Feature Restriction There are a few features and methods in Java that overly simplify the concepts we are trying to teach. For that reason, do not use any of the following in your final submission: var (the reserved keyword) Checkstyle The Checkstyle deduction limit for this assignment is 5 points, not counting Javadoc errors. Refer to the course guide for the use of Checkstyle and review the autograder Checkstyle report on your submissions. Collaboration Collaboration Statement To ensure that you acknowledge a collaboration and give credit where credit is due, we require that you place a collaboration statement as a comment at the top of at least one .java file that you submit. That collaboration statement should say either: I worked on the homework assignment alone, using only course materials. or In order to help learn course concepts, I worked on the homework with [give the names of the people you worked with], discussed homework topics and issues with [provide names of people], and/or consulted related material that can be found at [cite any other materials not provided as course materials for CS 1331 that assisted your learning]. If the autograder encounters issues processing your collaboration statement, begin it with "Collaboration Statement: ". Turn-In Procedure Upload the files listed below to the corresponding assignment on Gradescope: ClassroomOrganizer.java For each submission, you will be able to see the results of a few basic test cases on your code. Each test typically corresponds to a rubric item, and the score returned represents the performance of your code on those rubric items only. If you fail a test, you can look at the output to determine what went wrong and resubmit once you have fixed the issue. Important Notes Non-compiling files will receive a 0 for all associated rubric items Do not submit .class files or .jar files Test your code in addition to the basic checks on Gradescope Submit every file each time you resubmit Read the "Allowed Imports" and "Restricted Features" to avoid losing points Check on Piazza for a note containing all official clarifications Problem Description Hello! Please make sure to read all parts of this document carefully. You will be writing a Classroom Organizer to help with seating students. In this assignment, you'll be using your knowledge of iteration and arrays to create a program that allows tracking and editing the location of students in a classroom. To do this, you will create and turn in a ClassroomOrganizer.java file that runs code in a main method. You are allowed to create helper methods (and we recommend you do), but only the main is required. Solution Description You will write a single file, ClassroomOrganizer.java. You must use all the kinds of loops explored in L7- L8 at least once. ClassroomOrganizer.java Classroom Organizer will simulate a terminal prompt where the user can input commands to edit and print the locations of students. Before describing the commands, we will explore the format of the classroom in the output. Here's an example of the output formatting for a classroom with 2 rows and 4 columns, with some seats assigned: # DE # ABC # ####### # ] # # KLMNO ############ ### # FGHI # ######## # # ######## You can observe that the output formatting has the following features: At the top and bottom, as well as between each classroom row, there's a row of #. On the left and right, as well as between each classroom column, there's a column for #. The length (in number of characters) of each column is determined by the student who has the longest name. It should fit that name, as well as one space to the left and one to the right. Columns always have a length of at least 3, even if no student is seated anywhere in that column. Names are always centered. If it's impossible to center it exactly (like DE), one more space will be added to the right of the name in the output. ClassroomOrganizer will receive from console arguments two integers representing the number of rows and columns, which describes the layout of the classroom. You will use a String 2D array to keep track of who is seated at each seat. The top row is 0, and the left-most column is 0. For example, java ClassroomOrganizer 2 4 would create a layout like the one in the output formatting. In the example o Student ABC: row 0, column 0 Student DE: row 0, column 2 o o Student FGHI: row 0, column 3 o Student J: row 1, column 0 o Student KLMNO: row 1, column 2 If any of the rows' or columns' inputs are invalid (note: there must be at least one seat in the classroom), the program will print an error message "Invalid classroom size" and finish the program. o Note: while the inputs aren't always valid, they are guaranteed to be two integers. This will also apply to all inputs in the program: the input format will always be valid, but the integer values may not be. Tip: You can use Integer.parseInt, which is the int-equivalent to the Double.parseDouble from lecture. Until the program finishes, the program will ask for a command by printing "> " and allowing the user to input a command through console input in the same line. The program will execute the command (or print an error message), and, if the program didn't finish, ask for a command again. If the command is quit, the program will finish without further output. If the command is print, the program should print the current classroom seating assignment, following the output formatting described above. If the command is go: o A go command always has the following format (without the brackets): go to [row] [column] [name] (name doesn't have spaces) o It will place a student (who can be in another seat or outside the classroom) into the seat at the location of the appropriate row or column o If it fails, it will print one of the following errors: If the student was already there, the error is: "[name] is already there" If another student was there, the error is: "[other student name] is there" If the location is invalid, the error is: "Invalid location" o If it succeeds, and the classroom isn't full, it will print nothing. o If it succeeds and the classroom is now full, it will print "Classroom is full", followed by the classroom seats (same output as print), and finish the program. If the command is move: o A move command is always one of the following (without the brackets): move up [name], move down [name], move left [name], move right [name] (name doesn't have spaces) Recommended Methods While not required, we recommend you use helper methods (methods that "support" main or other methods) to structure your program. We provide the following list of methods (all of which should be static methods, like those in L9). This is an example of methods that you could write (but feel free to structure your program differently!). o It will move a student who is in the classroom into a seat relative to the current location of the student, based on their current location (for example, move up would move a student in location 10 to location 0 0) o If it succeeds (the student location changed), it prints nothing. Otherwise, it will print one of the following errors: If the student is not in the classroom, the error is "[name] is not in the classroom" If another student was in the new location, the error is "[other student name] is there" If the new location is invalid, the error is "Invalid location" boolean isClassroom Full (String[][] classroom) void handleGo (String[][] classroom, int row, int column, String name) void handleMove (String[][] classroom, String direction, String name) void printClassroom (String[] [] classroom) int[] calculateColumn Lengths (String[][] classroom) void printSeparator Row(int length) void printClassroom Row (String[] classroomRow, int[] columnLengths) String centered (String name, int columnLength) Example Output 1 - User Input is Bolded. Your program should look exactly like this. java command: java ClassroomOrganizer 21 > print ***** # > go to 1 0 Alice > print ********* # # Alice # **** > go to 0 0 Bob classroom is full ********* # Bob # # Alice # *** Example Output 2-User Input is Bolded. Your program should look exactly like this. java command: java ClassroomOrganizer 44 > go to 1 1 Alice > go to 2 1 Bob > go to 1 2 Charlie > go to 2 2 Dave > print ###* # # ########## # ###* # #### # # # Alice # Charlie # # # # Bob # Dave # # > move left Bob > move down Alice # > move right Dave > move up Charlie > print ##: # # # # # ## # Bob # Alice # #### # # # Charlie # # # > move right Dave Invalid location > move left Alice Bob is there > quit # # # # # # # # Dave # ### # Rubric [100] ClassroomOrganizer.java [90] Several scenarios (not necessarily all weighted equally). Each scenario is scored all- or-nothing, depending on whether the input/output matches the solution. . [10] Other checks o [2.5] x 4: Uses each kind of loop at least once. We reserve the right to adjust the rubric, but this is typically only done for correcting mistakes. Allowed Imports To prevent trivialization of the assignment, you are only allowed to import java.util.Scanner. You are not allowed to import any other classes or packages. Feature Restriction There are a few features and methods in Java that overly simplify the concepts we are trying to teach. For that reason, do not use any of the following in your final submission: var (the reserved keyword) Checkstyle The Checkstyle deduction limit for this assignment is 5 points, not counting Javadoc errors. Refer to the course guide for the use of Checkstyle and review the autograder Checkstyle report on your submissions. Collaboration Collaboration Statement To ensure that you acknowledge a collaboration and give credit where credit is due, we require that you place a collaboration statement as a comment at the top of at least one .java file that you submit. That collaboration statement should say either: I worked on the homework assignment alone, using only course materials. or In order to help learn course concepts, I worked on the homework with [give the names of the people you worked with], discussed homework topics and issues with [provide names of people], and/or consulted related material that can be found at [cite any other materials not provided as course materials for CS 1331 that assisted your learning]. If the autograder encounters issues processing your collaboration statement, begin it with "Collaboration Statement: ". Turn-In Procedure Upload the files listed below to the corresponding assignment on Gradescope: ClassroomOrganizer.java For each submission, you will be able to see the results of a few basic test cases on your code. Each test typically corresponds to a rubric item, and the score returned represents the performance of your code on those rubric items only. If you fail a test, you can look at the output to determine what went wrong and resubmit once you have fixed the issue. Important Notes Non-compiling files will receive a 0 for all associated rubric items Do not submit .class files or .jar files Test your code in addition to the basic checks on Gradescope Submit every file each time you resubmit Read the "Allowed Imports" and "Restricted Features" to avoid losing points Check on Piazza for a note containing all official clarifications
Expert Answer:
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these algorithms questions
-
Find the equation for the lower half of the circle x + (y-8) = 7. Put the equation in the form y = g(x), and then enter g(x) into the answer box below. Enter your answer as a symbolic function of x,...
-
Yale Company purchased equipment having an invoice price of $21,500. The terms of sale were 2/10, n/30, and Yale paid within the discount period. In addition, Yale paid a $320 delivery charge, $350...
-
If a typical eyeball is 2.00 cm long and has a pupil opening that can range from about 2.00 mm to 6.00 mm, what are (a) The focal length of the eye when it is focused on objects 1.00 m away, (b) The...
-
A trade association (or trade group) is an organization that firms in the same industry form to collect and disseminate trade information, offer legal and technical advice, furnish industry-related...
-
Refer to the data in Exercises 8-25 and 8-27. Compute the cost of goods transferred out and the ending inventory using the FIFO method.
-
1. In figure, two identical particles each of mass m are tied together with an inextensible string. This is pulled at its centre with a constant force F. If the whole system lies on a smooth...
-
Nour Youssef operates as a sole trader. Below is a trial balance extracted from her books as at 31 December 2020. Trial balance for Nour Youssef as at 31 December 2020 Debit Credit _ . Sales...
-
A circular reference is an error a majority of the time in a worksheet indicating a single formula that references itself or multiple formulas that reference each other. The Invoice worksheet has a...
-
Smith rented a house from Jones, but noticed exposed electrical wiring so Smith refused to move in. Jones fixed the wiring a month after the lease was to start. By that time, Smith had moved...
-
If we have the following changes what is the impact on our cash position? Sales: +10,000 Rent: +2,500 Depreciation: +4,500 Accounts Receivable: +6,500 Accounts Payable: +5,500
-
Anton wants to make 5lb of sugar syrup. How much water and how much sugar does he need to make each concentration of sugar syrup? 20% syrup
-
1) Some pharmacists have refused to fill prescriptions for RU-486 (the morning-after pill) because of their religious and moral convictions. Some pharmacies have refused to stock RU-486 because of...
-
Bacteria can be differentiated according to their reaction to a gram stain. a. Gram-positive bacteria stain (appear) red because they retain the crystal violet dye after being stained by the gram...
-
If someone's Z-score for a variable was 0.67. Their score is a significant extreme score. Their score is not significant. O Their score is slightly above average. O Their score is an outlier.
-
Find a company exporting its products under the same brand name in all (or most) markets and a company that uses a variety of brands. How do these companies differ and are these the reasons for...
-
Indias Tata Motors, the nations largest vehicle maker, purchased bankrupt Daewoo Commercial Vehicles in 2004 in order to gain entry into the South Korean market and access to Daewoos technology. It...
-
In the decade of the 2010s, the plans and operations of Avon Inc. in marketing, research, and manufacturing throughout Asia are still being affected by actions taken after a 1998 meeting. The US...
-
Consider the following project information. The total budget is $36,000 and is expected to last six months. After four months, you have calculated the following information about the project: PV =...
-
You had planned to construct a series of eight traffic roundabouts in your town, with each roundabout costing $150,000. Your goal was to complete the project during the four (4) months of good...
-
Go to www.nu-solutions.com/downloads/earned_ value_lite.pdf and access the article by Q. W. Fleming and J. M. Koppelman, Earned Value Lite: Earned Value for the Masses. From your reading, summarize...
Study smarter with the SolutionInn App