![]() ![]() ![]() ![]() Don’t forget to head over to the code runner on Moodle and paste your solution in the answer box! The file should be named as daysInMonth.cpp. So, for instance, 1900 was not a leap year but 2000 was.Įxtra credit: if you use a switch statement for this question, we will give you 5pt extra credit. For dates after 1582, however, there is a Gregorian correction: years that are divisible by 100 are not leap years but years divisible by 400, are. What is a leap year? In general, years divisible by 4 are leap years. If the entered month is not between 1 and 12, then print “Invalid month ”. Then, the program should display the number of days in that month. Write a program that asks the user to enter a year and month(1-12). Don’t forget to head over to the code runner on Moodle and paste your solution in the answer box! The users are well trained, and they will enter weights separated by spaces. If two or more weights are the same, they are considered as neither. “Ascending order ”, “ Descending order ”, or “ Neither ”. If the weights are sorted, then it prints Your manager gave a task to write a program that takes weights of three boxers (as integer values) and check if they are sorted by their weights. If not, print “Invalid input”. The total price should be formatted with a two-digit precision as shown below.Įxpected output 3 ( bold is user input) The value entered should be greater than 0. ![]() Write a program that asks the number of sushi pieces eaten and compute the total price. His restaurant offers a student discount depending on the number of pieces they eat. Don’t forget to head over to the code runner on Moodle and paste your solution in the answer box!Īshwin opened a sushi restaurant in Seattle. The total pay(pay check) should be formatted with a two-digit precision as shown below.Įxpected output 1 ( bold is user input)Įxpected output 2 ( bold is user input) Instead of printing the negative value of the pay, print “Invalid input ”.įor example, if Punith worked 42 hours (40 hours + 2 hours of overtime), and his pay rate is $12. If a pay rate of -$10 and 41 hours worked, then the pay would be -$415. If one or both input values are negative values, it does not make sense. Hours worked over 40 hours are considered as overtime and should be calculated at 1.5x the pay rate.īe sure to have input validation. Then, it displays the calculated total pay. Write a program that asks the number of hours worked and hourly pay rate, as floating point numbers. The file should be named as practicum.cpp. The practicum average should be a double formatted with a two-digit precision as shown below.Įxpected output 1 ( bold is user input) Enter practicum 1 score: 90 “You can retake practicums during the final. ”Įach practicum score should be an integer value. “You have a passing practicum average. ” If the calculated average score is 67 or higher, then it prints Then, it prints the average score and prints the message depending on the average score. Write a program that asks the user to enter three practicum scores and calculate the average score. It would be useful to have a program to calculate your practicum average. In this course, students need to have at least 67 average score on practicums to earn C- or higher letter grades. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |