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
2.Think about it
Rewrite each expression as an addition expression.
-22 – (-34)
...
2. 24 – 15 – (-31)
-22+34 24+15+-31
Partner Practice: Rewrite each expression as an addition expression.
Subtraction Expression
Addition Expression
23 - 43
23+(-43)
19 - 68
19+(-68)
-14 - 43
-14+(-43)
-1 - 8
-1+(-8)
45 - (-14)
45+14
-23 - (-65)
-23+65
Evaluate Expression:
-23 - 15
-23+(-15)
-38
12 - 33 12+(-33) -21
14 – 23 + (-9) 14+-23+(-9) -9+(-9)
Melanie has $65 in her account. She spends $12 on a book and $40 on a bag. Her sister asks her “are you going to have enough money to contribute $15 towards mom’s birthday gift?” Melanie replies- “no problem!”
Understand:
Plan:
Estimate/Predict:
Solve:
Answer: Melanie _________________ have enough money to contribute to her mom’s birthday gift.
Think About it
Evaluate each expression using the addition rules we have developed.
6 + (-10)
-4
-11 + 19
8
-6 + (- 7) -13
-26
Independent Practice:
Evaluate Expression:
-33 – (-44)
11
27 – 48
27+(-48)
-16 – 22
-16+(-22)
Which equations below are not true statements? Select all that apply. Explain your selection.
71 – (-19) = 90
71 – 19 = 52
-71 – 19 = -52
-71 + 19 = -52
-71 – (-19) = -90
A submarine is at a depth of 12 meters below sea level. The submarine then descends 79 meters. What is the depth of the submarine now? (*descends means moving down)
Jennah was evaluating the expression -7 – 83 +14.
Here is her work:
-7 + 83 + 14
75 + 14
89
Do you agree or disagree with her answer? Explain your answer using complete sentences.
The Titans and the Broncos played football last week. The table below shows each team’s first five plays of the game.
Play
Titans
Broncos
1
Loss of 15 yards
Gain of 25 yards
2
Gain of 24 yards
Gain of 19 yards
3
Loss of 12 yards
Loss of 11 yards
4
Gain of 38 yards
Loss of 17 yards
5
Loss of 21 yards
Loss of 14 yards
I) Which team had gained more yards after the fifth play?
II) How many more yards did they gain?
View More
3.Think About it
Evaluate each expression using the addition rules we have developed.
6 + (-10)
-4
-11 + 19
8
...
-4
-11 + 19
8
-6 + (- 7) -13
-26
Rewrite each expression as an addition expression.
-22 – (-34) 2. 24 – 15 – (-31)
-22+34 24+15+-31
Partner Practice: Rewrite each expression as an addition expression.
Subtraction Expression
Addition Expression
23 - 43
23+(-43)
19 - 68
19+(-68)
-14 - 43
-14+(-43)
-1 - 8
-1+(-8)
45 - (-14)
45+14
-23 - (-65)
-23+65
Evaluate Expression:
-23 - 15
-23+(-15)
-38
12 - 33 12+(-33) -21
14 – 23 + (-9) 14+-23+(-9) -9+(-9)
Melanie has $65 in her account. She spends $12 on a book and $40 on a bag. Her sister asks her “are you going to have enough money to contribute $15 towards mom’s birthday gift?” Melanie replies- “no problem!”
Understand:
Plan:
Estimate/Predict:
Solve:
Answer: Melanie _________________ have enough money to contribute to her mom’s birthday gift.
Independent Practice:
Evaluate Expression:
-33 – (-44)
11
27 – 48
27+(-48)
-16 – 22
-16+(-22)
Which equations below are not true statements? Select all that apply. Explain your selection.
71 – (-19) = 90
71 – 19 = 52
-71 – 19 = -52
-71 + 19 = -52
-71 – (-19) = -90
A submarine is at a depth of 12 meters below sea level. The submarine then descends 79 meters. What is the depth of the submarine now? (*descends means moving down)
Jennah was evaluating the expression -7 – 83 +14.
Here is her work:
-7 + 83 + 14
75 + 14
89
Do you agree or disagree with her answer? Explain your answer using complete sentences.
The Titans and the Broncos played football last week. The table below shows each team’s first five plays of the game.
Play
Titans
Broncos
1
Loss of 15 yards
Gain of 25 yards
2
Gain of 24 yards
Gain of 19 yards
3
Loss of 12 yards
Loss of 11 yards
4
Gain of 38 yards
Loss of 17 yards
5
Loss of 21 yards
Loss of 14 yards
I) Which team had gained more yards after the fifth play?
II) How many more yards did they gain?
View More
4.Think About it
Evaluate each expression using the addition rules we have developed.
6 + (-10)
-10-10
-11 + 19
-8
...
-10-10
-11 + 19
-8
-6 + (- 7) -13
Rewrite each expression as an addition expression.
-22 – (-34) 2. 24 – 15 – (-31)
-22+34 24+15+-31
Partner Practice: Rewrite each expression as an addition expression.
Subtraction Expression
Addition Expression
23 - 43
23+(-43)
19 - 68
19+(-68)
-14 - 43
-14+(-43)
-1 - 8
-1+(-8)
45 - (-14)
45+14
-23 - (-65)
-23+65
Evaluate Expression:
-23 - 15
-23+(-15)
-38
12 - 33 12+(-33) -21
14 – 23 + (-9) 14+-23+(-9) -9+(-9)
Melanie has $65 in her account. She spends $12 on a book and $40 on a bag. Her sister asks her “are you going to have enough money to contribute $15 towards mom’s birthday gift?” Melanie replies- “no problem!”
Understand:
Plan:
Estimate/Predict:
Solve:
Answer: Melanie _________________ have enough money to contribute to her mom’s birthday gift.
Independent Practice:
Evaluate Expression:
-33 – (-44)
-33+44
27 – 48
27+(-48)
-16 – 22
-16+(-22)
Which equations below are not true statements? Select all that apply. Explain your selection.
71 – (-19) = 90
71 – 19 = 52
-71 – 19 = -52
-71 + 19 = -52
-71 – (-19) = -90
A submarine is at a depth of 12 meters below sea level. The submarine then descends 79 meters. What is the depth of the submarine now? (*descends means moving down)
Jennah was evaluating the expression -7 – 83 +14.
Here is her work:
-7 + 83 + 14
75 + 14
89
Do you agree or disagree with her answer? Explain your answer using complete sentences.
The Titans and the Broncos played football last week. The table below shows each team’s first five plays of the game.
Play
Titans
Broncos
1
Loss of 15 yards
Gain of 25 yards
2
Gain of 24 yards
Gain of 19 yards
3
Loss of 12 yards
Loss of 11 yards
4
Gain of 38 yards
Loss of 17 yards
5
Loss of 21 yards
Loss of 14 yards
I) Which team had gained more yards after the fifth play?
II) How many more yards did they gain?
View More
5.Evaluate each expression using the addition rules we have developed.
6 + (-10)
-10-10
-11 + 19
-8
-6 + (- 7) -13
...
-8
-6 + (- 7) -13
Make tweaks, leave comments, and share with others to edit at the same time.
NO THANKSUSE THE APP
Austin Cassista - Reteach Lesson 7 & 8
Think About it
Evaluate each expression using the addition rules we have developed.
6 + (-10)
-10-10
-11 + 19
-8
-6 + (- 7) -13
Rewrite each expression as an addition expression.
-22 – (-34) 2. 24 – 15 – (-31)
-22+34 24+15+-31
Partner Practice: Rewrite each expression as an addition expression.
Subtraction Expression
Addition Expression
23 - 43
23+(-43)
19 - 68
19+(-68)
-14 - 43
-14+(-43)
-1 - 8
-1+(-8)
45 - (-14)
45+14
-23 - (-65)
-23+65
Evaluate Expression:
-23 - 15
-23+(-15)
-38
12 - 33 12+(-33) -21
14 – 23 + (-9) 14+-23+(-9) -9+(-9)
Melanie has $65 in her account. She spends $12 on a book and $40 on a bag. Her sister asks her “are you going to have enough money to contribute $15 towards mom’s birthday gift?” Melanie replies- “no problem!”
Understand:
Plan:
Answer: Melanie _________________ have enough money to contribute to her mom’s birthday gift.
Independent Practice:
Evaluate Expression:
-33 – (-44)
-33+44
27 – 48
27+(-48)
-16 – 22
-16+(-22)
Which equations below are not true statements? Select all that apply. Explain your selection.
71 – (-19) = 90
71 – 19 = 52
-71 – 19 = -52
-71 + 19 = -52
-71 – (-19) = -90
A submarine is at a depth of 12 meters below sea level. The submarine then descends 79 meters. What is the depth of the submarine now? (*descends means moving down)
Jennah was evaluating the expression -7 – 83 +14.
Here is her work:
-7 + 83 + 14
75 + 14
89
Do you agree or disagree with her answer? Explain your answer using complete sentences.
The Titans and the Broncos played football last week. The table below shows each team’s first five plays of the game.
Play
Titans
Broncos
1
Loss of 15 yards
Gain of 25 yards
2
Gain of 24 yards
Gain of 19 yards
3
Loss of 12 yards
Loss of 11 yards
4
Gain of 38 yards
Loss of 17 yards
5
Loss of 21 yards
Loss of 14 yards
I) Which team had gained more yards after the fifth play?
How many more yards did they gain?
View More
7.A manufacturer of bicycles builds 1-, 3- and 10-speed models. The bicycles are made of both aluminum and steel. The
...
uminum and steel. The company has available 38 comma 160 units of steel and 48 comma 380 units of aluminum. The 1-, 3-, and 10-speed models need, respectively, 8, 12 and 16 units of steel and 15, 10, and 20 units of aluminum. The company makes $4 per 1-speed bike, $6 per 3-speed, and $16 per 10-speed. Use the simplex method to complete parts (a) and (b).
(a) How many of each type of bicycle should be made in order to maximize profit? What is the maximum profit?
Set up the linear programming problem. Let x 1, x 2, and x 3 represent the numbers of 1-, 3-, and 10-speed bicycles, respectively, and let z be the total profit.
▼
Minimize
Maximize
zequals
nothing
subject to
8 x 1 plus 12 x 2 plus 16 x 3
▼
greater than
less than or equals
greater than or equals
less than
nothing
15 x 1 plus 10 x 2 plus 20 x 3
▼
greater than
less than or equals
less than
greater than or equals
nothing
x 1greater than or equals0, x 2greater than or equals0, x 3greater than or equals0.
(Do not factor. Do not include the $ symbol in your answers.)
Set up the initial simplex tableau and use the Simplex Method to solve.
The maximum profit is $
nothing. To get that profit, the company should make
nothing 1-speed bicycle(s),
nothing 3-speed bicycle(s), and
nothing 10-speed bicycle(s).
(Type whole numbers.)
(b) Explain what the values of the slack variables in the optimal solution mean in the context of the problem. Select the correct choice below and, if necessary, fill in the answer box(es) to complete your choice.
A.
When the profit is maximized, all of the steel is used but
nothing units of aluminum remain unused.
(Type a whole number.)
B.
When the profit is maximized, some of each material remains unused. Specifically,
nothing units of aluminum and
nothing units of steel remain unused.
(Type whole numbers.)
C.
When the profit is maximized, all of the available aluminum and steel is used.
D.
When the profit is maximized, all of the aluminum is used but
nothing units of steel remain unused.
(Type a whole number.)
View More
8.
Value: 1
equation image indicator
a. (x - 2)2(x - 3)2
b. (x2+ 4)(x2+ 9)
c. (x - 2)(x +
...
2)(x - 3)(x + 3)
d. (x2 - 4)(x2+ 9)
Value: 1
The table below shows the cost of purchasing a standard stapler at five office supply stores, A through E. If the median cost of purchasing a standard stapler for these stores was $17.99, which of the following could NOT have been the cost of the stapler for Store A?
staplergraph.jpg
a. $19.95
b. $18.95
c. $16.95
d. $19.25
Value: 1
If equation image indicator then x =
a. 7
b. 1/5
c. 5
d. 1/7
Value: 1
A six−sided die, with sides numbered 1,2, 3,4,5, and 6, is tossed. What is the probability of tossing a number less than three?
a. 1/3
b. 0
c. 1/2
d. 1/4
Value: 1
If 6m + 4 = 8m, then 4m =
a. 6
b. 2
c. 8
d. 4
Value: 1
In the xy-plane, what is the y-intercept of the graph of the equation equation image indicator?
a. 2
b. 4
c. 16
d. There is no y-intercept.
Value: 1
Which of the following equations has both 2 and −4 as solutions?
a. x2 + 6x + 8 = 0
b. x2 - 2x - 8 = 0
c. x2 + 2x - 8 = 0
d. x2 - 2x + 8 = 0
Value: 1
The perimeter of a square is 20 ft. If you increase the length of the square by 2 feet and decrease the width by 1 foot, what is the area, in square feet, of the new figure?
a. 22
b. 28
c. 35
d. 40
Value: 1
(3x-2y4)-3 =
a. equation image indicator
b. equation image indicator
c. equation image indicator
d. equation image indicator
Value: 1
A softball is tossed into the air upward from a first floor balcony. The distance of the ball above the ground at any time is given by the function, distance function.png, where h(t) is the height of the softball above the ground (in feet) and t is the time (in seconds). What was the maximum height, in feet, of the softball above the ground after it was thrown?
a. 28
b. 30
c. 32
d. 34
Value: 1
A group of 100 people, some students and some faculty, attended a museum opening. Each student paid $10 per person for entrance to the museum and each of the faculty paid $25 per person for entrance. If the total paid, for all 100 people, was $1300, how many students attended the museum opening?
a. 20
b. 50
c. 70
d. 80
Value: 1
The ratio of Sam's age to Hank's age is 5 to 3. If the sum of their ages is 24, how old is Hank?
a. 21
b. 15
c. 19
d. 9
Value: 1
In the xy−coordinate plane shown below, point P has coordinates (8, −6). Which of the following is an equation of the line that contains points O and P?
O and P graph.jpg
a. equation image indicator
b. equation image indicator
c. equation image indicator
d. equation image indicator
Value: 1
The variables x and y are inversely proportional, and y = 2 when x = 3. What is the value of y when x = 9?
a. 54
b. 6
c. 2/3
d. 3/2
Value: 1
A farmer has 1235 trees to be planted on a rectangular parcel of land. If there are 24 trees planted in each row and each row must be complete before it is planted, how many trees will be left over after planting?
a. 21
b. 11
c. 0
d. 55
View More