Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Practice Midterm Exam 2 - Spring 2023 CS 18000 - Merge

Practice Exam 2

Instructions

Question 1

Question 2

Submit!

Instructions

Important: Read all of these instructions before beginning this practice exam. They are similar to the instructions included in the actual exam.

You have 120 minutes (two hours) to complete all the questions. This will be enforced using the exam timer on Vocareum. Failure to submit before the timer reaches 0 or by 6:00 pm Tuesday, November 1 (whichever comes first) will result in an exam score of 0.

Submitting your work on Vocareum will save your progress and record a snapshot of your current solution. The most recent submission will be the one that is graded. It is highly recommended to submit frequently. There is no limit on the number of times you can submit on Vocareum. Failure to submit will result in an exam score of 0.

This exam consists of 2 free-response coding questions:

Question 1 is worth 50 points.

Question 2 is worth 50 points.

All classes, methods, fields, and associated implementation details must be named exactly as described and include required modifiers to be scored.

This exam is open book, open notes. You may also reference lecture slides, lecture videos, and previous Ed Discussion posts. You may not utilize any other electronic sources.

All work must be your own. Accepting assistance from another student or outside individual, or copying code from any source (other than code you have written yourself) is cheating and is strictly prohibited.

You may choose to do your work in either a local IDE (Intellij, Eclipse, etc.) or on Vocareum. Regardless of your choice, you must submit your solutions via Vocareum before the timer reaches 0 or by 6:00 pm Tuesday, November 1 (whichever comes first).

You may not post questions regarding the exam anywhere, including Ed Discussion and any other online forums, websites, or communication channels.

Your submission must compile on Vocareum to be graded. If your submission has compilation errors and does not compile, you will receive a zero for that question.

You will not receive any partial credit if your submission has compilation errors.

If you run into any technical or access problems, you must immediately email [email protected]. Note: No content questions will be answered during the exam window. You may email concerns to the coordinators, but do not wait for a reply to continue your exam. Instead, continue working and make a submission before the timer expires. If a technical problem prevents you from submitting on Vocareum, you must email a copy of your solution to the coordinators before your time expires. We will not score any exam material received after the two hour limit

Coding Standards are not scored for exams. However, rules prohibiting modifiable static fields, as well as those concerning static, global, or multiple Scanner declarations and instantiations, all still apply.

Question 1 – Color

After you finish reviewing your lecture notes, watching the recordings, and going over previous assignments, you realize that there's still more that you can do to prepare for the second CS 18000 Midterm Exam. This brilliant inspiration leads you to complete the practice exam, in fact, it is what you are doing right now. This is a great opportunity to practice Classes, File IO, Exception handling, and text processing, all of which are sure to appear on the exam (hint: they most certainly will).

This question will require that you process files to generate colors. To make the problem extra challenging, you decide to process the colors given their RGB values. RGB color values refer to a specific combination of integer values representing red, green, and blue that can generate unique colors. Each integer will have a value between 0 and 255, inclusive.

You must create and implement two classes: Color and ColorMixer. We will provide input prompts as part of the Starter Code.

All ColorMixer methods must be public and static.

Note:

In this question, we ask you to implement a variety of methods. You should not assume that the methods will be called in any particular order. That is, we may call a method directly rather than running your program with the main method. Implement processing accordingly.

As we have noted in all your other assignments that process user input, do not use multiple Scanners, static Scanners, or global Scanners during this question. You will not receive any credit for a solution that does so.

Use caution for any static field. Remember that it will be shared by the class, so any values assigned statically will appear in every test case. If your program depends on a static field for processing, it will likely fail most of the tests.

Your code must compile to be scored. As each of these classes are interrelated, it is critical that you verify each compiles when you submit. Otherwise, you will lose all the points for this question.

Implementation Guidelines

File Format

You must read data from files to answer this question. Typically, the file will have the following format:

FIRST_COLOR_RED_VALUE

FIRST_COLOR_GREEN_VALUE

FIRST_COLOR_BLUE_VALUE

SECOND_COLOR_RED_VALUE

SECOND_COLOR_GREEN_VALUE

SECOND_COLOR_BLUE_VALUE

[And so on for every line in the file]

Where FIRST_COLOR_RED_VALUE is replaced by the corresponding integer referring to that color’s red value.

For example, a file may contain the following:

2

0

3

203

192

0

The given file would generate two Colors with the following characteristics:

Color One

Red: 2

Green: 0

Blue: 3

Color Two

Red: 203

Green: 192

Blue: 0