Starting from:

$25

CSE174 Program 6


PROGRAM #6: 30 points 

 

Outcomes:   

Write programs that obtain user input
Write programs that manipulate String objects
Write programs that use if and else statements for decision-making
Write programs that use methods
Format and comment source code that adheres to a given set of formatting guidelines
 

Scoring:

At a bare minimum, the program you submit must have the assigned source code, and your source code must compile and run without crashing.
If you do not submit a zip file containing your source code (.java file), your score will be zero.
If you submit source code that does not compile, your score will be zero.
If you submit source code that roughly resembles the requirements and it compiles, but it crashes under normal operating conditions (nice input from the user), your score will be reduced by 75%.
Deductions will be made for not meeting the usual requirements:
Source code that is not formatted according to guidelines
File and class names that do not meet specifications
 
Full credit
No credit or Partial credit
Class Triangles (5 points)
The program you submitted solved the problem Triangles.
The program you submitted do not solve or only partially solve the specified problem
Class EarthTemp (5 points)
The program you submitted solved the problem EarthTemp.
The program you submitted do not solve or only partially solve the specified problem
Class VolumeCalculator (15 points)
The program you submitted solved the problem VolumeCalculator.
The program you submitted do not solve or only partially solve the specified problem
Format output as specified (5 points)
Your output is formatted as specified, including proper spacing, spelling, rounding values to the specified number of places, and so on
You did not follow some or all of the requirements for output
 

 

 

Assignment
1.       In a class named Triangles, write a program that displays three triangles with[2]  the selected characters.

2.       In a class named EarthTemp, write a program to take a depth (in kilometers) inside the earth as input data; compute and display the temperature at this depth in degree Celsius and degree Fahrenheit.

3.       In a class named VolumeCalculator, write a program that calculates: a) the volume of a sphere, b) the volume of a cylinder, or c) the volume of a cube. First, the program asks the user to input one of the three possible options, if the user enters a different option, the program will show an error message and end the program. For each option, the program will ask the corresponding measures such as radius, height, side length; then it will calculate and display the result of the operation.

Requirements
·         In class Triangle,

o   Create a method which draws one triangle given a character as argument.

o   The program must call the drawing method three times with the corresponding characters.

·         In class EarthTemp,

o   Create two methods:

§  getCelsiusAtDepth – calculates and returns the Celsius temperature at a depth measured in kilometres.

Celsius = 10 * depth + 20

§  convertCelsiusToFahrenheit – converts a Celsius temperature to Fahrenheit.

Fahrenheit = 1.8 * Celsius + 32

·         In class VolumeCalculator:

o   The only valid options for the initial input are a, b, and c. Other options will raise an error message, even those which start with the character of a valid option i.e. car, boat, apple also raise an error message.

o   The volume of a sphere must be calculated in a method with a return value, given the radius.

o   The volume of a cylinder must be calculated in a method with a return value, given the radius and height.

o   The volume of a box must be calculated in a method with a return value, given the side length.

o   The input values can be of type double.

o   The output should be presented with three decimal places.

 
 
Sample run
Your program should match this format as closely as possible. Note that some text shown inside the rectangles is there because the user typed it. You are not supposed to print those.

class Triangle



Class EarthTemp

 



 


 

Class VolumeCalculator



 



 







 

 

 

Follow these steps to submit your work:

Create an empty folder named program6.
Put copies of your three source code files (.java) in the program6 folder. Do not put any other files in that folder. There should be exactly three .java files.
Compress the folder to create a zip file. Be sure it ends with .zip.
Submit only the zip file to the Canvas website.
 

Note: If you submit your work and decide to modify one of your programs, you need to resubmit a new zip file containing all three source code files (even if you only modified one of them). Do not rename your source code files. Do not rename the zip file. Canvas may add a number to the name of your

 


 [1]/methods
 [2]using

More products