1.CSE 1300
Problem Solving Practice Conditional Statements
Question 1: Student Fees
All KSU students pay fees in addition to their tuition.
Using the code
...
nts pay fees in addition to their tuition.
Using the code provided below as a starting point, write a conditional statement that determines how much a student will pay in fees.
• Students registered for 1 – 4 hours pay $843 in student fees.
• Students enrolled in 5 or more hours pay $993 in student fees.
The program should also display a message to students who have not enrolled in any classes: “You are not enrolled in any classes right now.”
NOTE: You must use the variables included in the code snippet get credit for this question.
import java.util.Scanner;
class Main {
public static void main(String[] args) {
int creditHours;
int fees = 0;
Scanner myScanner = new Scanner(System.in);
System.out.print("Please enter the number of credit hours you are taking this term: "); creditHours = myScanner.nextInt();
myScanner.close();
//YOUR CODE GOES HERE
} }
Break the Problem Down
Answer the following questions, then use the information to write your code.
What are the inputs in the pseudocode above? (INPUT)
What are we storing in the pseudocode above? (MEMORY)
What calculations are needed? (PROCESSES)
What needs to be displayed to the user?
(OUTPUT)
How many conditions are there in your problem statement?
What are they?
Does something need to happen if the condition(s) are not met?
What type of conditional statement do you need?
Solution in Java
Problem 2: Block Tuition
The cost of KSU’s tuition is determined by the number of credit hours a student enrolls in.
Using the chart below, write a conditional statement (ONLY) that sets the value of a tuition variable to what that student will owe.
NOTE: For this problem you can assume that all students are enrolled in a minimum of 12 hours.
Number of Credit Hours 12
13
14
15 or more
Cost (in USD) $2224 $2410 $2595 $2718
Break the Problem Down
Answer the following questions, then use the information to write your code.
What do we need to store? (MEMORY)
What are the inputs in the problem statement above? (INPUT)
What calculations are needed? (PROCESSES)
What needs to be displayed to the user?
(OUTPUT)
How many conditions are there in your problem statement?
What are they?
Does something need to happen if the condition(s) are not met?
What type of conditional statement do you need?
Solution in Java
Problem 3: Class Standing
Undergraduate students will be classified based on the number of earned institutional hours.
• Freshman:
• Sophomore:
• Junior:
• Senior:
0 - 29 hours
30 - 59 hours 60 - 89 hours
90 hours or more
Write a complete program that prompts the user for the number of credit hours they have completed. Write a conditional statement that prints out their class standing based on the information they provided.
Sample Output
Break the Problem Down
Answer the following questions, then use the information to write your code.
What do we need to store? (MEMORY)
Please enter the number of credit hours you have earned: 29 You are a freshman.
What are the inputs in the problem statement above? (INPUT)
What calculations are needed? (PROCESSES)
What needs to be displayed to the user?
(OUTPUT)
How many conditions are there in your problem statement?
What are they?
Does something need to happen if the condition(s) are not met?
What type of conditional statement do you need?
Solution in Java
Problem 4: Maximum Course Load
KSU’s policy on maximum course loads during the academic year is as follows:
A student in good standing may register for up to 18 hours. The Registrar may approve up to 21 hours for students with an institutional GPA of 3.5 or higher. Students
Write a complete program that prompts the user for the number of credit hours they have signed up for. Write the necessary conditional statement(s) to address the stipulations in KSU’s policy. Once the maximum number of hours is determined, display a message to the user that states “You may enroll in X credit hours this semester.” where X is the number of credit hours determined by your program.
Sample Output
Break the Problem Down
Answer the following questions, then use the information to write your code.
What do we need to store? (MEMORY)
Please enter your GPA: 3.75
You may enroll in up to 21 credit hours this semester.
What are the inputs in the problem statement above? (INPUT)
What calculations are needed? (PROCESSES)
What needs to be displayed to the user?
(OUTPUT)
How many conditions are there in your problem statement?
What are they?
Does something need to happen if the condition(s) are not met?
What type of conditional statement do you need?
Solution in Java
Problem 5: First-Year Seminar
All first-year full-time students entering Kennesaw State University with fewer than 15 semester hours are required to complete a First-Year Seminar. Students with 30 or more credit hours are not eligible to enroll in a First-Year Seminar.
Write a complete program that prompts the user for the number of credit hours they have completed. Write the necessary conditional statement(s) to address the stipulations in KSU’s policy.
When you run your program, it should display one of the following messages to the screen:
• You must enroll in First-Year Seminar.
• You do not have to take First-Year Seminar.
• You are not eligible for First-Year Seminar.
Sample Output
Break the Problem Down
Answer the following questions, then use the information to write your code.
What do we need to store? (MEMORY)
Enter the number of credit hours have you completed: 30
You are not eligible for First-Year Seminar.
What are the inputs in the problem statement above? (INPUT)
What calculations are needed? (PROCESSES)
What needs to be displayed to the user?
(OUTPUT)
How many conditions are there in your problem statement?
What are they?
Does something need to happen if the condition(s) are not met?
What type of conditional statement do you need?
Solution in Java
View More
3.: There are four things that you need to do in order to successfully complete this module's discussion questions assignment.
...
on questions assignment. First, if you have not already done so, read pages 381-382 in the textbook. Second, complete the discussion questions that appear below. Please copy and paste the questions onto a Word document; then, type your responses after each question. To view the questions, please scroll down.
Third, in the textbook, read “A Modest Proposal” by Jonathan Swift (pages 214-222) and “How to Raise a Pimp” by Darryl L. Fortson, M.D. (pages 231-233). Fourth, complete the discussion questions regarding “A Modest Proposal” and “How to Raise a Pimp.” Again, please copy and paste the questions onto a Word document; then, type your responses after each question. To view the questions, please scroll down.
Due Date: Please see the Canvas announcement regarding this assignment.
Final Thoughts: Good luck with this assignment. You do not need to write an essay response to each question, so please do not do so. In fact, you should be able to successfully respond to each question in several sentences or a paragraph at most. If you have any questions or concerns, please feel free to e-mail or call me.
Discussion Questions
Pages 381-382
1. On pages 381-382, there is paragraph about tropical fish. Please quote the author’s stated claim exactly as it appears in the paragraph. (Hint: the stated claim is one sentence long.)
2. On pages 381-382, there is paragraph about tropical fish. Since this paragraph is a satire, you know that the stated claim is not what the author truly believes, so please paraphrase the author’s implied claim. (Hint: the implied claim should be one sentence in length.)
3. On page 382, there is paragraph about circuses. Please quote the author’s stated claim exactly as it appears in the paragraph. (Hint: the stated claim is one sentence long.)
4. On pages 381-382, there is paragraph about circuses. Since this paragraph is a satire, you know that the stated claim is not what the author truly believes, so please paraphrase the author’s implied claim. (Hint: the implied claim should be one sentence in length.)
Discussion Questions
“A Modest Proposal” by Jonathan Swift
1. The author of the work is not the same individual who is making the claim. In fact, Swift assumes a persona, the persona of someone he, hopefully, is not. List some of the characteristics of his alter-ego.
2. What is the proposer’s (we will use the word proposer to identify the individual making the claims) attitude toward the beggars he describes in the opening paragraphs?
3. In one sentence, paraphrase the proposer’s stated claim.
4. In one sentence, paraphrase the proposer’s implied claim.
5. According to the proposer, what are some of the issues that need correcting?
6. How does the use of facts and statistics help to bolster the proposer’s credibility?
7. Who will be the beneficiaries of this modest proposal?
8. Identify at least four good things that will come from this modest proposal.
9. Does the proposer address any arguments that might be raised against his modest proposal? If so, how does he address them?
10. Looking at the final paragraph, why does the proposer end his modest proposal in this manner?
11. Who is the intended audience of this satire?
12. Did you enjoy this satire? Why?
13. Does this satire have any relevance for us reading it today? If so, what is it?
Discussion Questions
“How to Raise a Pimp” by Darryl L. Fortson, M.D.
1. In one sentence, paraphrase the author’s stated claim.
2. In one sentence, paraphrase the author’s implied claim.
3. According to the author, what are the four things that one must do in order to raise a pimp?
4. Who is the intended audience of this satire?
5. What is the author trying to accomplish with his satire?
6. Did you enjoy this satire? Why?
7. Do you think this satire is effective? Why?
View More