Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives 1. Evaluate arithmetic expressions, assignment statements 2. Write a program that reads input from the user Grading Requirement Points Completed Problem #1: Arithmetic Expressions

image text in transcribedimage text in transcribedimage text in transcribed

Objectives 1. Evaluate arithmetic expressions, assignment statements 2. Write a program that reads input from the user Grading Requirement Points Completed Problem #1: Arithmetic Expressions Canvas "quiz" 10 Problem #2: Reading Input Four tests (1.5 points each) GA Evaluation of Code TOTAL POSSIBLE POINTS Print Full Name: Submission Note Even though on-campus students will submit the first page to your GA to assist in attendance/grading, everyone must take the Lab 4 Quiz in Canvas and submit a file to Web-CAT for grading. That file is: 1. SimpleInput.java Problem #1: Exercise on Arithmetic Expressions First, you have an exercise (labeled as a quiz in Canvas) to work through that will cover determining if arithmetic statements are valid or invalid as well as calculating the results of some arithmetic formulas. Log into Canvas and work through the appropriate exercise/quiz. This is a timed exercise that you will have 25 minutes to complete. Problem #2: Reading Input You will write a program from scratch that accomplishes the following: Create a new Java class file named SimpleInput Create a Scanner object to read input from the keyboard Prompt the user for their first name on one line (use System.out.println() for your prompt) Use your Scanner to read the user's name from the keyboard Print a message that says hello to the user (i.e., Hello ) on the next line Skip a line, then prompt the user for the year they were born on a line by itself (again, use System.out.println() for the prompt) Read in the value (which will be on its own line) Print the year they were born on the next line Calculate and print the age in years that the user will be this year on the next line Declare a constant for average life expectancy, set its value to 78.7 Print the percentage of their expected life that they've lived on the next line Skip a line, then prompt the user for what they believe the value of Pi to be on a line by itself (again, use System.out.println()) Read in the value (which will be on its own line) Print the value they entered on the next line Print how close they are to the actual value of Pi (22 divided by 7), print just the numerical difference Example Run (example user input is underlined) What is your name? Lauren Hello Lauren What year were you born? 1995 1995 24 30.495552731893262 What is the value of Pi? 3.14159 3.14159 0.001267142857142911 Some quick notes: In order for Web-CAT to grade your program correctly, your output should be almost identical in format to the example run. Remember the different ways of reading in a String , an integer, and a double Every prompt should be on its own line, all user entered values should be on their own line, then echo the user input on the next line as a value Once your program compiles and runs correctly, have the GA verify that you are done. STOP! Have a lab assistant check off this requirement on your lab sheet before moving forward. Demonstrate that you have written the program and that it works correctly. Wrap-up Make sure for this lab that you have done both of the following: Work through the lab 4 exercise in Canvas by the appropriate due date. Submit your file via jGRASP to Web-CAT for grading

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane X z 2/3 90% a/3

Answered: 1 week ago