CS115 – Lab 01 Solved

25.00 $

Category: Tag:

Description

5/5 - (1 vote)

Submit a single .zip file containing all the .java and .doc/.pdf/.txt files.
A – Basic Problem Solving – Input-Process-Output Design (2.5 points each) Answer the following questions for the problems listed below. No code is needed:
1. What are the inputs?
o What format are they in? (e.g., integer, floating-point, character, or string) o Any valid or invalid values? (e.g. positive, negative, valid range, certain values) o How do you get them? (e.g., prompt user or read from file)
2. How do you get from inputs to the outputs you want (process) o What are the calculation steps? o To follow these steps, what else do you need?
o Other variables, constants, conversion? (besides input and output variables) o Libraries (e.g., for calculations).
3. What are the outputs?
o What format are they in? o How do you output them? (e.g., on screen or to a file)
Fruit – You have a store that sells lemons and oranges. Oranges are $.30 each and lemons are $.15 each. For a certain number of oranges and lemons, calculate the total bill.
estimate gpa – You would like to calculate your GPA
(GPA=pointsEarned/creditHoursCompleted) after this term is over. You already know how many credits you have completed prior to this term and your GPA prior to this term. And you are estimating that you will get all As (each worth 4) this term for 15 more hours (4*15=60 points earned this term). What will your new GPA be?
count change – Most banks provide change counting machines for their customers. Given the number of pennies, nickels, dimes and quarters, calculate the total value of all this change.
paint needed – You are given the length, width and height of a rectangular room measured in real number of feet. You are also given the number of windows and number of doors in the room. You want to buy enough full gallons of paint to paint the four walls and ceiling of the room in one color (minus the area of windows and doors).
Doors are 24 square feet. Windows are 18 square feet One gallon of paint paints 350 square feet.
Calculate the total number of full gallons of paint you need.

B – Basic Problem Solving – Testing (2 points each)
Create a test plan with sample data for each problem. You do not have to calculate expected results or write code, but please explain why each test case was chosen as related to the problem. For each problem make a table like this with enough rows.
Test Case Reason Sample Data

Also include a description of any error checking on the input values that you should do.
mortgage – The bank wants to be sure you can afford to pay them back before they give you a mortgage. One way they consider your ability to repay is by making sure your total debt doesn’t exceed a certain percentage of your income, usually 36-42%. This percentage is called the debt ratio. Given your monthly income (a real number) and other monthly debt payment(a real number), you can use the following formulas to determine the lower and upper limits on your monthly mortgage payments.
Lower limit = (36% of your income) minus your other monthly debt Upper limit = (42% of your income) minus your other monthly debt
polar coordinates – A point in the two dimensional plane can be represented by its cartesian coordinates x and y or by its polar coordinates theta (angle) and r (radius). Write a program given a radius and angle (in degrees) of a point to calculate and display the x and y cartesian coordinates of that same point.
recycle – The rate your high-rise building is charged for waste and recycling collection is based on the total weight of the waste (which must be dumped in a landfill) and the total weight of the items that can be recycled. If the recycle items weight is greater than or equal to the waste weight, you are charged $10 per 100 pounds of waste. Otherwise you are charged $10 per 100 pounds of waste plus recycle weight.
minumumCoins – Given an amount of change to return after a purchase (assume between 1 and 99 cents), convert the amount to a minimum number of coins (quarters worth 25 cents, dimes worth 10 cents, nickels worth 5 cents, pennies worth 1 cent).

  • Lab01-c0775d.zip