This is one possible solution (code and output) for the Week 1 Check in problem. Keep in mind that there are many ways to solve this problem, so be as creative as possible!
Please send your instructor an email if you need help with setting up Eclipse or solving this problem. Write a method called shift. Given an integer array, return another array where each of the numbers is shifted one over to the right. The first number of the shifted array should be 1. In the main method, print out both of the arrays, the original one and the shifted one.
You don't need to ask the user for the integer array, just define it in your main method. Sample Output: The original array is: 2 5 6 1 8 9 7 The shifted array is: 1 2 5 6 1 8 9 Hints:
You tutor 3 students in Java, and you just gave them a test. You have the students’ names and their scores out of 20, but you need help calculating their percentage and letter grades.
Write a method that, given the student’s name and their score (out of 20), will print out a statement of the student’s name, their percentage grade, and their letter grade.
Sample Output: Enter Student 1's name: Alice Enter Student 1's score: 19 Alice got 95%, A. Enter Student 2's name: Bob Enter Student 2's score: 17 Bob got 85%, B. Enter Student 3's name: Charlie Enter Student 3's score: 15 Charlie got 75%, C. Create a restaurant simulation using a switch statement! Feel free to adapt this problem for similar stores, like video game stores, bookstores, or movie rental shops.
Bonus: Right after step 3, ask the user if they want to order another dish. Hint: put your switch statement inside a while loop. Use a boolean variable as your loop's condition, and at the end of the loop, ask the user if they want to order again. Sample Output: Welcome to my restaurant! 1. Sandwich ($7) 2. Salad ($8) Choose an item from the menu above: 1 Here's your sandwich! Enjoy! Do you want to order more food (true/false)? true Choose an item from the menu above: 2 One salad just for you! Do you want to order more food (true/false)? false Thanks for visiting my restaurant! Your total cost is: $15 Have fun with this problem - be as creative as you want! Write a program that calculates the factorial of a given number.
Hints: Keep a variable, something like "product," that keeps track of the growing product. You will need to use a multiplication assignment operator in your loop. Sample output: Enter an integer (except 0): 4 Factorial of 4 (using while loop): 24 Factorial of 4 (using for loop): 24 A talking parrot means trouble only if it is talking before 7:00 or after 20:00 (8 pm). The purpose of this program is to tell the user whether or not we are in trouble.
Sample: Is the parrot talking (enter true or false)? true What hour is it (enter an integer from 0-23)? 8 Phew! We are not in trouble! Submit a screenshot of your code and output using the weekly survey link (this is the same link you used for the last two check ins). Check back here on Sunday for the answer! Make a calculator program that prints the results of an operation on two numbers.
Ask the user for two numbers. Add, subtract, multiply, divide, and mod the numbers, and store these results in variables. Then print the results out. Bonus: Ask the user to guess what the results will be. Print out true (if the user's guess equals the answer) or false (if not equal). Hint for the Bonus: When you print out an expression, if the expression is true, "true" will be printed on the screen (same for false). Sample: Enter a number: 4 Enter another number: 2 What is 4 + 2? 6 true 4 + 2 = 6 4 - 2 = 2 4 * 2 = 8 4 / 2 = 2 4 % 2 = 0 Submit a screenshot of your code and output using the weekly survey link! Check back for the answer on Sunday. Make a mad libs game: Ask the user for a number and a name using the Scanner object, and store these in variables. Print out a funny sentence with these variables!
Sample: Type a number: 5 Type a name: Alice Alice is 5 years old. Submit a screenshot of your code and output using the weekly survey link! Check back for the answer on Sunday. Hello students! Thank you for signing up for coding classes! This blog will provide you with information about the weekly check in exercises to complete for practice at the end of every class.
Instructions for each check in will be posted here, and they will also be provided to you at the end of every session. Please complete the weekly exercise and upload a screenshot of your code and output using the weekly survey link given during class. Please check this blog for the answers to check ins, which will be posted every Sunday. Check ins are helpful to your instructors, who want to make sure that you are understanding the material taught during class, and they help you become a better coder! |