$25
PROGRAM #4: 25 points
Outcomes:
• Write programs that obtain user input
• Write programs that compute mathematical results
• Write programs that work with Strings
• 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 StringSwapper problem (5 points)
You thoroughly tested your StringSwapper class, 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
1. (5 points) Read and understand the pseudocode of problem R2.20 from the end of chapter 2 in your textbook. In a Java class named StringSwapper, write a java program that reads an input string, 2 indexes in the string and displays a new string with the characters at these 2 positions swapped.
2. (5 points) In a Java class named BookstoreOrder, solve problem P2.22 from the end of chapter 2 in your textbook.
3. (5 points) In a Java class named ExtractDollarsAndCents, solve problem P2.25 from the end of chapter 2 in your textbook.
4. (5 points) Include a set of test cases for StringSwapper program. Include a list of the test cases at the top with the comments and the expected outputs. (Read Section 3.6 about Test Cases). You should also indicate the test case(s) that did not work for your program along with the wrong output it printed. Note that this part of the assignment is worth 5 points. You can get full credit for this, even if your StringSwapper class does not always produce the correct answer.
5. Follow these steps to submit your work:
a. Create an empty folder named program4.
b. Put copies of your three source code files (.java) in the program4 folder. Do not put any other files in that folder. There should be exactly 3 .java files.
c. Compress the folder to create a zip file. Be sure it ends with .zip.
d. 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 zip file. That is fine. But you should keep all filenames the same.