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.1. Estimate a second stage (also called the stable stage) growth rate in dividends, g2, for use in the Two-Stage
...
he Two-Stage DDM. Your estimate for g2 is the growth rate that you expect will continue “forever” in the second stage. Your estimate for g2 should not be much greater than the expected future growth in the overall economy (expected growth in GDP). Why? LIST your estimate for g2 and provide a short paragraph that EXPLAINS your reasoning AND the source of your estimate for long-term growth in GDP. Finally, estimate and LIST a price per share for KO using your estimates for g1, N, Re, g2 and KO’s current annual dividend (most recent quarterly dividend x 4) as D(0) in the Two-Stage DDM (submit your spreadsheet).
2. Calculate KO’s FCFF for EACH of the past five (5) years using the financial statement data found in KO’s annual reports and using the FCFFM.xls template. The template will calculate the annual FCFF value for you, but you MUST insert the correct input values for Depreciation & Amortization, Capital Investment, Capital Sales, etc.
3. Assume that the average annual FCFF from Q5 is good estimate of KO’s FCFF(0) for use in the FCFM. LIST your estimate for FCFF(0) then estimate and LIST a price per share for KO using your estimates for g1, N, WACC, g2 and FCFF(0) in the Two-Stage FCFFM (submit your spreadsheet).Use the same estimate second stage or stable stage growth, g2, in the FCFFM that you selected for the DDM.
4. Apply Relative Valuation methods to Coca-Cola (KO) using the following three (3) popular relative valuation ratios - Price/Earnings, Price/Book, Price/Sales (call these three ratios Price/”X” ratios). Select at least five (5) comparable firms that are in the same industry as KO and use the average P/X ratio for the group of comparable firms in your valuation analysis. The P/X ratios for the template can be found by using the screener on the Finviz.comwebsite. Use the Relative Valuation (RV) Excel spreadsheet tab found in the Two Stage_DDM_FCFE_FCFF_RV.xlsx file.
View More
3.Hello, I have a problem calculating probability for a certain thing that happened. I'll try and make it sound like
...
it sound like a math problem.
The problem :
What are the chances of a 4 sided die landing on 1 twice and on 2 twice out of 4 rolls. The solution I came up with originally was (2/4) x (2/4) x (2/4) x (2/4) . Which I realized was wrong as this allowed the die to land on 1 four times in a row. So then I came up with this soultion (which i still think is wrong) (2/4) x (2/4) x (1/4) x (1/4) . So the reasoning behind this is : The first roll obviously has a 50% chance to roll on either 1 or 2. Second roll is the same. BUT, lets say both of them land on 1, and now it HAS to land on 2 the remaining two times. So my problem is with the current solution that I have is what if the die lands on 1 on the first roll, then on two for the second one. then the third roll would still have a 2/4 AKA a 50% chance of landing on either one. I'm sure the last roll is 1/4 but I just dont know if the order matters on the rolls. This has been driving me crazy the last hour. Please help if you can thanks
View More
4.Credit card sales The National Association of Retailers reports that 62% of all purchases are now made by credit card;
...
de by credit card; you think this is true at your store as well. On a typical day you make 20 sales.
Show that this situation can be modeled by a binomial distribution. For credit, you must discuss each of the criteria required for a binomial experiment.
Define the random variable x in this scenario, using the context of the problem.
List all possible values of x for this situation.
On one trial for this scenario, what does “success” mean? Explain using the words of the problem.
What is the probability of success in this scenario?
What is the probability of failure in this scenario?
Probability Distribution Instructions¬¬¬¬
In Excel, create a probability distribution for this scenario.
Label Column A as “x” and Column B as “P(x).”
In Column A, list the numbers 0 to 15.
In Column B, use BINOM.DIST.RANGE to calculate the probability for each x value.
Highlight the probability cells, then right click and select Format Cells. Format the probability cells as “Number” and have Excel show 4 decimal places.
Create a probability histogram using the probabilities you calculated. Format and label it properly. Be sure to use the “Select Data” button to change the x-axis so it correctly lists the x-values.
View More
5.So I am looking at polar and Cartesian and converting between the two. My question is, I have never seen
...
seen an equation of a circle this is moved in both the x and y direction be converted to a polar equation.
For example, I know that the equation of a circle x^(2)+(y-2)^(2)=4 is r=4sin(theta) when converted to polar. Same thing for a translation with the x variable. However, I have never seen, nor do I know how to do, a conversion of a circle with both translations. For example, converting this equation of a circle to a polar equation: (x+3)^(2)+(y-4)^(2)=4. I have no idea how to do such a thing and cannot find any examples of such.
Hope you can shed some light on this, Thanks.
View More
6.hello can you please help to solve this system of equations k == (Sqrt[y^2 - 2 y^3 - y^4 +
...
+ Sqrt[2 - 2 y] -
k)/((y + 1) Sqrt[1 - y^2]),
Sqrt[2]/2/m == k/(k - Sqrt[2 - 2 y]), n ==
Sqrt[2 - 2 Sqrt[1 - m^2]], z == Sqrt[2 - 2 y]/f ==
Sqrt[(zn)^2 - 2 + 2 y]/
Sqrt[n^2 - f^2], t == (Sqrt[g^2 - 2 g^3 - g^4 + 2 g + 1] +
Sqrt[2 - 2 g] - t)/((g + 1) Sqrt[1 - g^2]),
Sqrt[2]/2/h == t/(t - Sqrt[2 - 2 g]), q ==
Sqrt[2 - 2 Sqrt[1 - h^2]], l == Sqrt[2 - 2 g]/p ==
Sqrt[(lq)^2 - 2 + 2 g]/
Sqrt[q^2 - p^2], (z + 1) x == (l + 1) 2 x == (y + 1) Sqrt[1 - y^2]/
Sqrt[2] == Pi/4, q == m and determine true it or false thank you
View More
10.Calculating the % an object(A square) is overlapping with another(the screen, a rectangle)
Making a tilebased game,
2D rectangle tiles with a
...
a tilebased game,
2D rectangle tiles with a size of 5000X5000 pixels per rectangle.
I make every rectangle know the 4 neighbouring rectangles in the map so starting from one you can generate an essentially infinite map.
I want to move this map around instead of moving the player around, the player stays centered on screen and since the map moves under him it looks like he's the one doing the moving.
So I know the following things:
Width and height of a single section:
5000X5000 pixels
the x and y location of the center section can be a value anywhere from -5000,-5000 to 5000,5000
The visible screen real estate is 1920 X 1080 pixels big
0X,0Y always stars top left, bottom right is 5000X5000
What I need to end up with:
A percentage value of howmuch this specific section is visible on screen, "inside the rectangle that is the scfeen)
View More