ITSC121S2020Lab7

From BU Computer Science
Jump to navigation Jump to search

Seventh Lab, ITSC 121, Spring 2020

Overview

Write the following programs. The first one deals with triangles. The second deals with phones.

Program 1: Triangles (problem 6.19)

IMplement the following two methods:

/** return true if the sum of every two sides
 *  is greater than the third side. */
public static boolean isValid(double side1,
                              double side2, double side)
/** return the area of the triangle. */
public static double area(double side1, double side2,
                          double side3)

Write a test program that reads three sides for a triangle and uses the isValid method to test if the input is valid and uses the area method to obtain the area. The program displays the area if the input is valid, Otherwise, it displays that the input is invalid. The formula for computing the area o fa triangle is given in Programming Exercise 2.19. Be sure to include enough examples to adequately test your program. Your program should use input. Make sure your output looks nice.Quality testing is very important for this program and the rubric will reflect that.

Program 2: Phones

Inte international standard letter/number mapping for telephones is given in Programming Exercise 4.15. Write a method that returns a number, given an uppercase letter, as follows:
public static int getNumber(char uppercaseLetter)
Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (uppercase or lowercase) to a digit and leaves all other characters intact. Hare are sample runs of the program.
Enter a string: 1-800-Flowers
1-800-3569377

Enter a string: 1800Flowers
18003569377

For a challenge, reserach limits on valid phone numbers and include that in your program. Be sure to discuss this in your write-up if you choose do accept the challenge..

Reminders

  1. Include proper comments for all
  2. Use proper formatting, etc.
  3. Test with more than one set of data where it is appropriate
  4. Get the correct data outputted on the program before worrying about formatting

Submissions

  1. Create a software development report that includes the following for the program:
    • A problem summary (the big picture) for each program
    • A list of requirements for each program. (Things that this particular implementation of a solution must do)
    • A list of steps each of your programs do
    • A testing report for each program: What exact input you used and what output you got.
    • How long it took to write it, and how much time was on it each day!
    • Who you got help from (if you got help)
    • Changes (if any) you would make if you had more time and/or skill
    • At least two things you learned while writing the program(s)
  2. Create a zip folder with your software development report(s) and your java file(s) and submit that to canvas.
  3. Due date can be found on canvas