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.11. In a game, you draw thirteen cards with replacement from a deck of playing cards. If you draw any
...
y aces or twos, you lose the game immediately. You also lose if you draw picture cards(J,Q,K) more than twice. In this question, you’ll study the probability of winning this game.(a) What is the probability of drawing no aces or twos after thirteen draws?(b) Given you have drawn thirteen times, none of which is aces or twos, what is the probability that you draw at most two picture cards?(c) What is the probability to win this game?
12. Suppose you are tossing an unbiased coin for100times.(a) What is the probability of getting50heads and50tails?(b) LetXbe the random variable counting the number of heads you observe in this exper-iment. What is the expected value ofX? What is the variance ofX? What is thestandard deviation ofX?
13. The following are probability distributions for two random variablesX,Y.
kPr(X=k)
0,0.4
1,0.3
2,0.3
kPr(Y=k)
0,0.5
1,0.3
2,0.2
(a) Construct the probability distribution table for the random variableXY.(b) Find E[X],E[Y] and E[XY]. Is is true that E[XY] =E[X]E[Y]?(c) Find the variances σ2X,σ2Y,σ2XY of X,Y and XY. Is it true that σ2XY=σ2Xσ2Y?
14. The aliens who are fond of gambling came back to play another game with you. In this game, you first toss a coin5times. If you observe3or fewer tails, you roll a die3times. If youobserve4or more tails, you roll a die20times. What is the probability that you end up with at most two6’s in your dice rolls?
15. (Challenge question, worth2points) You have two bags, each of which contains10marbles.Each time you remove a marble from a random bag. What is the probability that after one of the bags is emptied, there are still exactly3marbles in the other bag?
View More
6.Company A has the current income statement below. Remember to show all your calculations for each question. Assuming a projected
...
estion. Assuming a projected increase in sales of 12% annually, a gross profit margin this year of 19.23%, an operating profit margin this year of 16.31% and a called dividend each year of 16% of after tax earnings, 23.U0 P Flag question Finish attem Time left 2:2 (1) complete the income statement below; (3 points) (2) prepare two subsequent years of pro formas; (6 points) (3) what is the gross profit margin for year 2? (1 point) (4) what is the operating profit margin for year 2? (1 points) (5) what is the gross profit margin for year 3? (1 point) (6) what is the operating profit margin for year 3? (1 point) (7) what is the compound annual growth rate of dividends from year 1 to year 3? (3 points) (8) What is the growth rate of the company's after tax earnings from year 1 to 3? (3 points) (9) If the company too 45% of this year's net profits after taxes and invested in a new line of business with anticipated cash flows of $60,000, $65,000, $75,000 and $90,000 over the next four years, assuming a 10% discount rate, what is the projects NPV? (3 points) (10) Would you recommend the project considered in question 9 above? Why or why not? (1 point) Income Statement of Company A Sales Revenue $4,396,223 Less COGS Fixed Costs Variable costs (42%) Gross Profits Less Operating Expenses Fixed Expenses Variable Expenses (2.8%) Operating Profits Less Interest Expense (2.7%) Net Profits before Taxes Less Taxes (21%) Net profits after taxes Less Dividend Increased Retained Earnings
View More
7.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
8.Hello I have two problems to solve the subject is Quantitative Methods for Decision-Making
Problem 2
After graduating from AUD, Salman plans
...
m 2
After graduating from AUD, Salman plans to start a book publishing company in the Media City. He did some research and found that the printer will cost Dh 230,000. He estimated that the variable cost per book is Dh 170 and the selling price is Dh 390.
a. How many books must he sell to break even? Also calculate the breakeven in dirham.
b. In addition to the costs given above, if he wants to pay himself a salary of Dh 15,400 per year, what is her breakeven point in units and dirham?
c. In the first three months of his business, he sold 400 books. Suddenly the printer breaks down. He spent Dh 25000 to fix the printer. In addition to 400 books sold, how many more books she should sell to breakeven? Assume that this part of the question is independent, and she does not draw any salary.
Problem 8
A furniture store makes tables and chairs from plywood and glass. The store has 30 units of plywood, 24 units of glass. Each table requires 7 units of plywood three units of glass, whereas each chair requires three units of plywood and two units of glass. The demand for chairs is between 2 and 4. The ratio between the table and chair is at least 1 to 2. A table earns $225 in profit and a chair, $145. The store also wants a minimum profit of $5000. The store wants to determine the number of tables and chairs to make in order to maximize profit. Formulate a linear programming model for this problem
View More
9.I have a research project and need help, this is the data set description:
Health researchers have identified a rise in
...
identified a rise in contacting STIs (sexually transmitted infections) among young adults and are interested in understanding why. The researchers measured several variables related to condom use including: likelihood of using condoms in the future, previous use of condoms, perceived ability for self-control in sexual relationships, and perceived risk for contracting STIs.
Method
This study is looking to understand why there has been a rise in sexually transmitted infections. Participants were asked to answer 4 different questions and the results were analyzed.
Participants: Participants include 100 men and women ages ranging from 18-38. The mean age in this experiment is 24 years old and there is an equal amount of men and women.
Name of Independent Variable(s): Provide a description of all independent (or grouping) variables, including their levels. Each variable should be described separately and the name of each new variable should be indented and underlined.
Name of Dependent Variable: Provide a description of the dependent variable, including how it was operationalized.
Following the description of all your variables you should clearly state (in a sentence) the research question you intend to investigate. Next, you should say something along the lines of, “This research has the following hypotheses:
Ha: State the alternate hypothesis in BOTH conceptual and statistical form.
H0: State the null hypothesis in BOTH conceptual and statistical form
Also I need to know what analysis to complete in spss
View More
10.Problem 4 (20 points). Consider the Newmarket 5K dataset. A dataset with certain rows deleted (where there was no Age
...
there was no Age and/or Sex entered) has been created. It is called Newmarket_Cleaned.csv.
Data file: Newmarket_Cleaned.csv
(Links to an external site.)
. Direct HTTP link: https://unh.box.com/shared/static/p8x4xlbean3rlslmfskfu74fe89yjui8.csv
Please use it for this problem. Consider the “Model 4” developed in class, which contained Age, Age^2, and Sex as independent variables. First re-create this model with the cleaned dataset (you will need to create the Age^2 column; you can verify your model summary against the one from class), and then proceed with this problem.
Make the necessary changes to the model to incorporate Year as a categorical explanatory variable (you may need to change how R interprets the variable, before running this model). Does the year of the race seem to be related to mean finishing time, after taking into account the other variables in Model 4? Use the 0.05 significance level. Explain your work/logic, and key output to support your answer.
Using the updated model, after accounting for age and sex, what is the expected difference in finishing times for runners from 2008 versus runners from 2004?
Using the updated model, after accounting for age and sex, what is the expected difference in finishing times for runners from 2014 versus 2011?
In the above, the directions are to treat Year as a categorical variable. Explain how the regression model would be different if it instead were treated as a numeric variable. What are the assumptions being made about the effect of Year in the two different approaches?
View More