CS M02 - Midterm 02 Midterm 02 is entirely a problem-focused exam. In this midterm, you will complete a combination of problems that will add up to the requisite maximum points (80 points). So, you...

1 answer below »
Problem3


CS M02 - Midterm 02 Midterm 02 is entirely a problem-focused exam. In this midterm, you will complete a combination of problems that will add up to the requisite maximum points (80 points). So, you can choose which problem #1 or #2 you are going to solve. Problem #3 is an Extra Credit. Your goal is to earn 80 points as a min. Most likely you will do two problems. Attention · There are multiple problems to choose from - you do not need to do them all, especially an Extra Credit. · You do NOT need to create a Program class or main methods, only if you want test your code. Exam Rules And Hints · You can use the following resources: · Book, notes, · slides from class, · class code examples EXCEPT the Practice Exam Code (honor system), · internet searches EXCEPT searching for the solution itself · It's easy to get overwhelmed by a problem. After understanding the basic objective for the exam, a good strategy is to first focus on the scaffolding from the UML: 1) classes; 2) attributes / instance variables; 3) operations / methods; 4) simple accessor / mutator implementations. After that, then focus on the logic components. It will be easier to get the logic done after the structure is in place because you can see what classes and methods you have to work with, plus you earn partial credit for the structure Problems Problem1 - Loan Eligibility Calculator (80 points) Problem2 - Printer Status (100 points) Problem3 - Area Estimator (EC - 100 points) Note: names of the class, method, and parameters must all be correctly spelled including the case of the letters (upper / lower), otherwise unit tests wont be working. Problem 1 - Loan Eligibility Calculator - 80 points Problem Context You are creating a business class for a Bank that will determine eligibility for a loan. The calculator will accept several pieces of information (amount requested, annual income, down payment, FICO score, and whether the borrower has a late payment history). Based upon the rules provided below, create the solution that satisfies the requirements. Requirements 1. Convert the UML class below to code. Names of the class, method, and parameters must all be correctly spelled including the case of the letters (upper / lower) 2. Rules for eligibility - Return true for cases matching Rule A, B, or C below Rule FICO (credit) Score Borrower Annual Income as % of requested loan amount Down Payment as % of requested loan amount Can have late payments Eligible A 700+ At least 15% More than 10% Yes Yes B 600+ At least 20% More than 15% Yes Yes C 600+ At least 15% More than 15% No Yes Problem 2 - Printer Status - 100 points Problem Context You are going to create an object-oriented solution that simulates the sensors and LED (light emitting diodes) for a printer with the following characteristics. The printer has five sensors: · Sensor A which detects if the printer is out of paper · Sensor B which detects if the printer is out of ink · Sensor C which detects if the printer needs servicing · Sensor D which detects if the printer is jammed · Sensor E which detects if an internal electronics error Requirements 1. Write a class called CustomPrinter. 2. Add a method to CustomPrinter with the following signature: getStatusIndicator(Sensor[] sensors) : LED (an enum) which returns the LED color for the conditions below. 3. Create a Sensor class. 4. Create an LED enumeration with the values in the table below. Sensor State Group Sensor State Result 1 No sensors set LED.Green 2 Out of ink LED.Blue 3 Out of paper or is jammed LED.Yellow 4 Needs servicing or internal electronics error LED.Orange 5 Any combination of sensors set that contains items across sensor state groups 2 – 4 LED.Red Problem 3 - Area Estimator- 100 points (EXTRA CREDIT) Problem Context You are going to create an object-oriented solution that estimates the area under a bounded curve for a given algorithm (to be provided below) Requirements 1. Implement the application from the UML diagram above that estimates the area under the curve by using the formula for the curve y = f(x) to determine the height of each rectangle at each interval x 2. The EstimationParameters consists of 3 pieces of data n – number of intervals (rectangles), x0 – starting x, xn – ending x. 3. The Algorithm class will implement the algorithm: y = x^2 - 3x + 1 and will be called multiple times from AreaEstimator (once for each x / interval) 4. An instance of the algorithm will be passed to the AreaEstimator constructor 5. The area calculator will use a LEFT Riemann Sum (see problem background) for the expression. 6. calculateArea method should return a value in X.XX format. HINT: double result = Math.round(totalArea * 100.0) / 100.0; // round to two decimal places) Problem Background and Information (only read if necessary for understanding). If we want to calculate the area under a curve, we can approximate it (with a margin of error) using something called Riemann sums. In essence, we are summing up the area of a number of rectangles that “fit” the curve. In the graphic example below for the curve y = x3, we have what is called a Left Riemann Sum where Left indicates we using the left edge of the rectangle as the height. A Right Riemann Sum would use the right edge of the rectangle as the height.
Answered Same DayApr 20, 2021

Answer To: CS M02 - Midterm 02 Midterm 02 is entirely a problem-focused exam. In this midterm, you will...

Aditya answered on Apr 20 2021
130 Votes
/*
* To change this license header, choose License Headers in Project Properties.
* To change th
is template file, choose Tools | Templates
* and open the template in the editor.
*/
package algo;
class CustomPrinter {
LED StatusIndicator;
int false_count = 0;
CustomPrinter(Sensor[] sa) {
if(sa[0].isIsSet() == true && sa[1].isIsSet() == false && sa[2].isIsSet() == false && sa[3].isIsSet() == true &&sa[4].isIsSet() == false)
{
StatusIndicator = LED.Yellow;
}
else if(sa[0].isIsSet() == false && sa[1].isIsSet() ==...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here