---+ Selection: Spring 2024 ---++ Learning Objective(s) 1 Learn to use selection 1 Write your first program 1 Learn to work with strings, characters, and integers ---++ Overview of the Program For this program you are to get the user to enter two numbers, an operation, and what they think the answer is. The program should then compute the answer and tell the user if they are correct. ---++ Specifics * The program should be called *Arithmetic.java* * All arithmetic is to be integer arithmetic * The user is to input a +, -, *, or / to indicate what operation * If a wrong operation is given, the program should inform the user that a wrong operation was given. ---++Sample dialogue Below is a sample dialogue. Your output can vary somewhat as long as the required data is nicely displayed <pre> What is the first number? 5 What operation (+, -, *, /)? + What is the second number? 7 What do you think the answer is? 15 You did not get it right.</pre> You can also run a solution for this program if you want. See classroom instructions for more details. ---++Submission a. Create your SDR. * In *Lessons Learned*, include a discussion on how the operation was inputted and handled. * If you used any hints, be sure to indicate that in the *Outside Resources Used* section a. Convert your SDR into a pdf document a. Create an empty zip folder a. Place your java file and pdf document in it. a. Submit the zip folder on canvas ---++Hints 1 [[CSC121S2024Lab02Hint1][Algorithm hint]] 1 [[CSC121S2024Lab02Hint2][Handing the operation]] ---++ Optional improvements Optional improvements should ONLY be worked on once the program is completing working. In addition, the work is to be done on your own with little if any help for lab assistants or the instructor. 1. Use a switch statement to decide what operation to compute
This topic: CenterForComputing
>
WebHome
>
Syllabi
>
CSC121SylS2024
>
CSC121S2024Lab02
Topic revision: r2 - 2024-01-18 - CathyBareiss
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback