Instructions Part 1 Download and Use Java API documents Download the Java API documents from: https://www.oracle.com/java/technologies/javase-jdk11-doc-downloads.html...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Instructions Part 1 Download and Use Java API documents Download the Java API documents from: https://www.oracle.com/java/technologies/javase-jdk11-doc-downloads.html You will need to review, and accept the terms of Oracle's licence agreement for the documentation. The downloaded file will have a name similar to: jdk-11.0.8_doc-all.zip Unzip the downloaded file, you will get a folder named docs It is recommended to move this folder, into your Java installation folder. o Following from Exercise 1 this would be: C:\AmazonCorretto\jdk11.0.7_10 (or similar version number) Open the docs folder, open the api folder, locate index.html You can open the index.html file and bookmark it in your browser, or right-click on the index.html and send a shortcut to the desktop. Use the link for Module java.base Use the link for java.lang Scroll down to find class Math and click on it's link Answer the following questions about class Math and provide them as part of your lab submission: 1. What does the class Math contain? (One sentence) 2. What are the names and data types of the two fields? 3. What method would let me calculate a square root of a number? 4. What method would return the result of calculating the power of a number, most calculators depict this operation as x Instructions Part 2 Plan, Create, Compile, Run a Java Program Using Eclipse, create a project named Exercise02 within your CST8116Workspace folder. (See Hybrid 1) Write a Java program that o obtains the value from each of the Math class fields, and outputs them to the console; o uses the Math class to calculate the square root of 25 and output the result on screen; uses the Math class to calculate the value of 2 raised to 16; o outputs your full name as seen in ACSIS on screen. Take a screen shot of your running program showing the outputs and paste this into your MS Word document as part of your second evidence of learning section. Provide programmer comments at the top of your source code file. Copy and paste all of your Java code into the MS Word document. Upload your MS Word document and Java code file to Brightspace. Java: I have to write a program that prompts the user for 3 numbers (length(how many times/numbers), a min, and a max. Then randomly generates numbers (however many times the user specifies under length) between the min and max numbers that the user specifies. Then I am supposed to display the array and the average of the rand generated numbers. I am stuck and have been trying to figure out how to go about it. What am I doing wrong? I know it needs a loop, but can't figure out where to go next. Any suggestions would be greatly appreciated! This is what I have so far: import java.util.Scanner; //Importing Java utility scanner so that it recognizes information to be entered by user import java.lang.Math; //Importing Math language so it will understand and correctly use Math verbage import java.util.Random; // Importing Java utility in order to utilize the random number generator public class Assignment2 { //Giving a name to the class public static void main(String[] args) { //Calling the main Scanner scnr = new Scanner(System.in); //Letting it know that information will be entered by user int length = 0; //These are the integers to be entered by the user int maxValue = 0; int minValue = 0; System.out.println("Enter size of sample: "); //The following 9 lines include the prompts for user to enter info length = scnr.nextInt(): //and also assigns the value the user enters into a variable System.out.println("Enter max possible value: "); maxValue = scnr.nextInt(): System.out.println("Enter minimum possible value: "); minValue = scnr.nextInt(): while (length >= 0): //As long as the number entered by user is > O, it will go into a loop of genrating random #s Random randGen = new Random():// Introducing the Random Number Generator! Yeaaaa! :) int randomNum = 0; randomNum = rand.nextInt((max- min) + 1) + min; System.out.print("Random Numbers: " + randomNum); Instructions Part 1 Download and Use Java API documents Download the Java API documents from: https://www.oracle.com/java/technologies/javase-jdk11-doc-downloads.html You will need to review, and accept the terms of Oracle's licence agreement for the documentation. The downloaded file will have a name similar to: jdk-11.0.8_doc-all.zip Unzip the downloaded file, you will get a folder named docs It is recommended to move this folder, into your Java installation folder. o Following from Exercise 1 this would be: C:\AmazonCorretto\jdk11.0.7_10 (or similar version number) Open the docs folder, open the api folder, locate index.html You can open the index.html file and bookmark it in your browser, or right-click on the index.html and send a shortcut to the desktop. Use the link for Module java.base Use the link for java.lang Scroll down to find class Math and click on it's link Answer the following questions about class Math and provide them as part of your lab submission: 1. What does the class Math contain? (One sentence) 2. What are the names and data types of the two fields? 3. What method would let me calculate a square root of a number? 4. What method would return the result of calculating the power of a number, most calculators depict this operation as x Instructions Part 2 Plan, Create, Compile, Run a Java Program Using Eclipse, create a project named Exercise02 within your CST8116Workspace folder. (See Hybrid 1) Write a Java program that o obtains the value from each of the Math class fields, and outputs them to the console; o uses the Math class to calculate the square root of 25 and output the result on screen; uses the Math class to calculate the value of 2 raised to 16; o outputs your full name as seen in ACSIS on screen. Take a screen shot of your running program showing the outputs and paste this into your MS Word document as part of your second evidence of learning section. Provide programmer comments at the top of your source code file. Copy and paste all of your Java code into the MS Word document. Upload your MS Word document and Java code file to Brightspace. Java: I have to write a program that prompts the user for 3 numbers (length(how many times/numbers), a min, and a max. Then randomly generates numbers (however many times the user specifies under length) between the min and max numbers that the user specifies. Then I am supposed to display the array and the average of the rand generated numbers. I am stuck and have been trying to figure out how to go about it. What am I doing wrong? I know it needs a loop, but can't figure out where to go next. Any suggestions would be greatly appreciated! This is what I have so far: import java.util.Scanner; //Importing Java utility scanner so that it recognizes information to be entered by user import java.lang.Math; //Importing Math language so it will understand and correctly use Math verbage import java.util.Random; // Importing Java utility in order to utilize the random number generator public class Assignment2 { //Giving a name to the class public static void main(String[] args) { //Calling the main Scanner scnr = new Scanner(System.in); //Letting it know that information will be entered by user int length = 0; //These are the integers to be entered by the user int maxValue = 0; int minValue = 0; System.out.println("Enter size of sample: "); //The following 9 lines include the prompts for user to enter info length = scnr.nextInt(): //and also assigns the value the user enters into a variable System.out.println("Enter max possible value: "); maxValue = scnr.nextInt(): System.out.println("Enter minimum possible value: "); minValue = scnr.nextInt(): while (length >= 0): //As long as the number entered by user is > O, it will go into a loop of genrating random #s Random randGen = new Random():// Introducing the Random Number Generator! Yeaaaa! :) int randomNum = 0; randomNum = rand.nextInt((max- min) + 1) + min; System.out.print("Random Numbers: " + randomNum);
Expert Answer:
Related Book For
Managerial Accounting
ISBN: 9780073526706
12th Edition
Authors: Ray H. Garrison, Eric W. Noreen, Peter C. Brewer
Posted Date:
Students also viewed these computer network questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Why do we need Normalization? How many forms of Normalization exist? What is the minimum normal form required? Describe each normal form List Normalization conversion process
-
In 2011 the owners of National Football League teams expressed a desire to increase the number of NFL games from 16 to 18 per season.The NFL players did not like this idea.Where does the idea of the...
-
Discuss the different types of spring materials.
-
If the 10-year Hong Kong government bond rate is 4.5 percent, the inflation premium is 2.3 percent, and the maturity-risk premium on the 10-year Hong Kong government bonds is 0.15 percent, assuming...
-
1. Based on the information given, discuss how well Performance Multiplier and Rypple meet the criteria for effective performance management: fit with strategy, validity, reliability, acceptability,...
-
which muscle were use to extend and splay your finger outward?
-
Kolbec Community College (KCC) has 4,000 full-time students and offers a variety of academic programs in three areas: professional studies, arts, and technology. The professional studies programs...
-
Alex owed Leo $ 85,000. Alex draws a bill on leo for that amount for 3 months on 1st April. Leo accepts it and returns it to Alex. On 15th April, Alex discounts it with AMK Bank at a discount of 12%...
-
Given the following source code: for(int j = 1; j
-
What are different financial metrics to compute company valuation based on the Sales Cash Flow Operating Income Net Income Book Value of Equity Market Value of Equity Total Debt Beta following...
-
Sarah is working in the operations management industry and wants to take an marketing course for 6 years, starting 6 years from now. Sarah plans to pay herself for this marketing course from his...
-
Imagine you are a Financial Planner, standing in an elevator with a prospective client. Write brief 30 second elevator speech to describe what you do and how you help clients. 2. Tom and Sara have...
-
Show that any matrix of the form (r, 8 R) represents a counterclockwise rotation on the plane, preceded or followed by scaling (the scaling factor being nonnegative). Express the angle of rotation...
-
Consider the sun, of mass Ms = 21030 kg, to be a plasma of completely ionized H atoms, of diameter 1.3106 km Set the temperature at the center of the sun is 1.5 106K, so what is the effective radius...
-
5. Convert the following ERD to a relational model. SEATING RTABLE Seating ID Nbr of Guests Start TimeDate End TimeDate RTable Nbr RTable Nbr of Seats RTable Rating Uses EMPLOYEE Employee ID Emp...
-
On January 2, Fred Critchfield paid $18,000 for 900 shares of the common stock of Acme Company. Mr. Critchfield received an $0.80 per share dividend on the stock at the end of each year for four...
-
Helix Company produces several products in its factory, including a karate robe. The company uses a standard cost system to assist in the control of costs. According to the standards that have been...
-
Brabant NV of the Netherlands is a wholesale distributor of Dutch cheeses that it sells throughout the European Community. Unfortunately, the company's profits have been declining, which has caused...
-
Use the numbers for the alcohol and tobacco category from the table in the Application "Goods with a Large Consumer Surplus Loss from Price Increases" to draw a figure that illustrates the roles that...
-
Change the answer given in the Challenge Solution for the short run rather than for the long run.
-
Because many consumers choose between coffee and tea, the coffee and tea demand functions depend on both prices. Suppose the demand curves for coffee and tea are where \(Q_{c}\) is the quantity of...
Study smarter with the SolutionInn App