Starting from:

$25

CSE174– Program 3 Solved

Outcomes:   

•       Write programs that obtain user input

•       Write programs that compute mathematical results

•       Write programs that display numbers formatted according to a given specification

•       Format and comment source code that adheres to a given set of formatting guidelines

•       Use a zip compression tool to combine multiple files

 

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 your source code (.java files), 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 (properly formatted source code, class names that do not meet specifications, and so on).

 

 
Full credit
No credit or Partial credit
Write solutions to the three given problems (15 points)
The programs you submitted solved the specified problems.
The programs you submitted do not solve or only partially solve the specified problems.
List test cases for the VanCalculator problem (5 points)
You thoroughly tested your VanCalculator code, listing the test cases that do and do not work.
You did not list test cases, or missed important test cases.
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.
 




Requirements: You will write three separate Java programs

(5 points) In a Java class named Letters, solve problem P2.18 from the end of chapter 2 in your textbook.  HOWEVER...do not use the word "HELLO".  Instead, print some other word using the same guidelines, but some different letters (you could include H if you want).  Your word should have at least 4 different letters in it.
 

(5 points) In a Java class named LineSegment, write a program that asks the user to enter the coordinates of two points, then display those points, the midpoint, and the slope of the segment that joins those points.  The output result should be formatted to look exactly like this:
           

Note that Scanner objects are good at parsing numbers as shown above.  The user could type all 4 values on separate lines, or type them separated with one or more spaces (but not commas), and the Scanner will handle them correctly.  You do not need to do anything special to try to "break apart" the two numbers with spaces between them.  The Scanner will handle them well.  Just call the nextDouble() method two times in a row, and the Scanner will grab each number separately, ignoring the spaces.

 

(5 points) Vans hold 20 people.  In a class named VanCalculator write a program that asks how many people need a ride, and then print the number of vans needed, formatting your output to match the following as closely as possible.


 

There are a variety of ways to solve this problem.  Your goal is to find a solution that only involves simple arithmetic (the symbols + - * / %).  In order to earn full credit, you should have a solution that does NOT use:

●      if statements

●      loops

●      Methods in the Math class (such as Math.sqrt())

If you write a correct solution but it uses one or more of the ideas from this list, you will only earn partial credit for your solution. 

If your program mostly gives correct answers, and you note that in your comments when you do your testing, you can earn 4 out of the 5 points for this problem.

 

(5 points) Test your VanCalculator class thoroughly.  You may find that your program works well with some numbers, but not others.  (You only need to test your program with positive whole numbers.)  If it does not work correctly with certain numbers, then you should try a different approach.  In the VanCalculator class, at the top of the comments, include a list of the numbers of people you tested with your program, indicating which test cases worked, and which cases did not.  It is important to test thoroughly.  If you find that your program does not work with certain numbers, you will earn credit for including the numbers that don't work.  If you say that your program works with all numbers, but it does not, you will lose credit for this part of the assignment.  You should indicate at least 10 numbers that you tried.  Be selective.  The goal is to test and find mistakes.  Here is a sample of what your source code might say (these comments should appear before the rest of your source code):
           

 

More products