This zyLab activity is intended for students to prepare for a larger programming assignment. Warm up...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This zyLab activity is intended for students to prepare for a larger programming assignment. Warm up exercises are typically simpler and worth fewer points than a full programming assignment. Warm up exercises are ideally suited for an in-person scheduled lab meeting or as self-practice. The last section provides a full programming assignment. A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (Submit for 2 points). (1) Output the user's input. Enter integer: 4 You entered: 4 (2) Extend to output the input squared and cubed. Hint: Compute squared as userNum* userNum. (Submit for 2 points, so 4 points total). Enter integer: 4 You entered: 4 4 squared is 16 And 4 cubed is 64!! (3) Extend to get a second user input into userNum2. Output sum and product. (Submit for 1 point, so 5 points total). Enter integer: 4 You entered: 4 4 squared is 16. And 4 cubed is 64!! Enter another integer: 5 4 + 5 is 9 4* 5 is 20 LAB ACTIVITY 1.37.1: Basic output with variables (Java) 1 import java.util.Scanner; 2 3 public class Test{ 4 5 6 7 8 9 10 11 12 13 14 15 16 17 public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int userNum = 0; int userNum2= 0; OutputWithVars.java //take the input of the first number System.out.print("Enter integer: "); userNum scnr.nextInt (); //print the first number System.out.println("You entered: "+userNum); //perform the arithmetics System.out.println(userNum+" squared is "+userNum* userNum); 0/5 Load default template... This zyLab activity is intended for students to prepare for a larger programming assignment. Warm up exercises are typically simpler and worth fewer points than a full programming assignment. Warm up exercises are ideally suited for an in-person scheduled lab meeting or as self-practice. The last section provides a full programming assignment. A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (Submit for 2 points). (1) Output the user's input. Enter integer: 4 You entered: 4 (2) Extend to output the input squared and cubed. Hint: Compute squared as userNum* userNum. (Submit for 2 points, so 4 points total). Enter integer: 4 You entered: 4 4 squared is 16 And 4 cubed is 64!! (3) Extend to get a second user input into userNum2. Output sum and product. (Submit for 1 point, so 5 points total). Enter integer: 4 You entered: 4 4 squared is 16. And 4 cubed is 64!! Enter another integer: 5 4 + 5 is 9 4* 5 is 20 LAB ACTIVITY 1.37.1: Basic output with variables (Java) 1 import java.util.Scanner; 2 3 public class Test{ 4 5 6 7 8 9 10 11 12 13 14 15 16 17 public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int userNum = 0; int userNum2= 0; OutputWithVars.java //take the input of the first number System.out.print("Enter integer: "); userNum scnr.nextInt (); //print the first number System.out.println("You entered: "+userNum); //perform the arithmetics System.out.println(userNum+" squared is "+userNum* userNum); 0/5 Load default template...
Expert Answer:
Answer rating: 100% (QA)
Prompt user for input userNum intinputEnter integer Output the users input p... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
Using Taylor series method find y at x = 0.1 if = y + 1,y(0) = 1.
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The General Auditors Office (GAO) of ABC jurisdiction issued a report on the XYZ Electric Cooperative, a large member-owned utility. This report reviewed the work of MNO Consulting. MNO found...
-
1. How many interference maxima will be contained in the central diffraction maximum in the diffraction interference pattern of two slits if the separation d of the slits is 5 times their width a?...
-
Why is sponsorship important to the success of a project?
-
An investment is guaranteed to have a unique value of IRR if which of the following is true? a. Alternating positive and negative cash flows b. An initial negative cash flow followed by all positive...
-
The following data for Throwback Industries, Inc. relate to the payroll for the week ended December 7, 2012: Employees Marino and Starr are office staff, and all of the other employees are sales...
-
Connect each yearly salary to the correct paycheck payment. A. $55,000 B. $60,000 C. $26,000 D. $129,000 E. $56,000 OS $500 weekly $5,000 monthly $2,333 semi-monthly $4,961 biweekly $4,583 monthly
-
Josie is an accounting supervisor at Monk & Sons Realty. She instructs her subordinate, Maria, to make certain accounting entries in the company's books that will increase revenue by a material...
-
The value of the euro was$0.84on October 27, 2000. On March 23, 2008, the same euro was worth$1.58. By how much did the value of the dollar depreciate against the euro? Show all your calculations. On...
-
Century Dental Associates has currently hired two assistants and two hygienists. The total fixed cost has been calculated at $250,000 annually and the indirect costs, including supplies, has been...
-
Olivia also bought a lot she was planning to build a house on 3 years ago for $120,000. She recently decided to sell it, rather than build. The lot increased in value and she sold it for $195,000....
-
Let's say we have a square whose sides all measure 11 inches. Determine to two decimal places the dimensions of the square (in inches) that has twice the area of this square.
-
Maryam owns a two-year GIC worth $85,000 (which is for her future travel plans), an RRSP worth $25,000, and a chequing account with a balance of $5,000. Each investment is held at a different branch...
-
An experienced bank auditor can verify a bank's deposits twice as fast as a new auditor. Working together, the auditors take 4 hours to do the job. How long would it take the experienced auditor to...
-
On average, Asia makes 14 out of 20 free throws. Assuming the relationship is proportional, how many more free throws is she likely to make if she shoots 150 free throws? The sum of three times a...
-
Controls can be identified based on their function. The functions are preventive, detective, and corrective. A. True B. False
-
Civil Code 1719, subdivision (a) provides in part that any person who draws a check that is dishonored due to insufficient funds shall be liable to the payee for the amount owing upon the check and...
-
Discuss contractual liability, warranty liability, and liability for conversion.
-
Fred Lane, who sells boats, motors, and trailers, sold a boat, motor, and trailer to John Willis in exchange for a check for $6,285.00. The check was not honored when Lane attempted to use the funds....
-
Why may some people consider this to be incorrect? That is, why is the fact that the control account is kept in the General Ledger not enough to justify saying that the control account is part of the...
-
From the following figures, compile accounts receivable ledger and accounts payable ledger control accounts for the month, and ascertain what the net balances of the respective ledgers should be on...
-
The financial year of The Better Trading Company ended on 30 November 2014. You have been asked to prepare a Total Accounts Receivable Account and a Total Accounts Payable Account in order to produce...
Study smarter with the SolutionInn App