1)- Modify the following code to read character from keyboard 2)- What is the output of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1)- Modify the following code to read character from keyboard 2)- What is the output of following code if ch is 65? public class ASCII { static public void main(String[] args)[ char ch = 65; //the 65 convert to ASCII character if (ch >= 48 && ch <= 58) } System.out.println("You enter a Digit"+ch+"\n"); else if (ch >= 'A' && ch <= 'Z'||ch >= 'a' && ch <= 'z') System.out.println("You enter a alphabet:"+ch+"\n"); else System.out.println("other character:"+ch); ] // write your code on the following window. Question 18 Assume the following: 2 pts • temperatures[] is an array of SIZE elements of type double that has been declared and initialized ⚫ threshold is a variable of type double that has been declared and initialized Write code to do the following • Create and initialize a variable named count to keep track of the number of values in temperatures[] array that are greater than threshold ⚫ Using a for loop, count the number of values in the array temperatures[] that are greater than threshold, and ⚫ Output the count to the console. Edit View Insert Format Tools Table 12pt Paragraph BIUA 2 > р O words </> Question 19 2 pts The formula to compute the volume of a sphere is volume (4/3)лг^3 where r is the radius of the sphere and л is 3.14159. Assume a variable radius has already been declared (type double) and initialized with the value of the radius of a sphere. Write a java method statements to do the following: Declare a constant Pl and initialize it to 3.14159 Declare a variable volume of type double Calculate the volume of the sphere and store it in the variable volume. Your program should return the result to main and display the computed volume on the console. Type in your answer on blow page. Edit View Insert Format Tools Table 12pt Paragraph BIU A > ✓ p O words </> 1)- Modify the following code to read character from keyboard 2)- What is the output of following code if ch is 65? public class ASCII { static public void main(String[] args)[ char ch = 65; //the 65 convert to ASCII character if (ch >= 48 && ch <= 58) } System.out.println("You enter a Digit"+ch+"\n"); else if (ch >= 'A' && ch <= 'Z'||ch >= 'a' && ch <= 'z') System.out.println("You enter a alphabet:"+ch+"\n"); else System.out.println("other character:"+ch); ] // write your code on the following window. Question 18 Assume the following: 2 pts • temperatures[] is an array of SIZE elements of type double that has been declared and initialized ⚫ threshold is a variable of type double that has been declared and initialized Write code to do the following • Create and initialize a variable named count to keep track of the number of values in temperatures[] array that are greater than threshold ⚫ Using a for loop, count the number of values in the array temperatures[] that are greater than threshold, and ⚫ Output the count to the console. Edit View Insert Format Tools Table 12pt Paragraph BIUA 2 > р O words </> Question 19 2 pts The formula to compute the volume of a sphere is volume (4/3)лг^3 where r is the radius of the sphere and л is 3.14159. Assume a variable radius has already been declared (type double) and initialized with the value of the radius of a sphere. Write a java method statements to do the following: Declare a constant Pl and initialize it to 3.14159 Declare a variable volume of type double Calculate the volume of the sphere and store it in the variable volume. Your program should return the result to main and display the computed volume on the console. Type in your answer on blow page. Edit View Insert Format Tools Table 12pt Paragraph BIU A > ✓ p O words </>
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Briefly describe ASCII and Unicode and draw attention to any relationship between them. [3 marks] (b) Briefly explain what a Reader is in the context of reading characters from data. [3 marks] A...
-
Describe what happens if you put the double quotes in the print statement of HelloWorld.java on different lines, as in this code fragment: System.out.println("Hello, World");
-
Is it possible to temper an oil-quenched 4140 steel cylindrical shaft 50 mm (2 in.) in diameter so as to give a minimum tensile strength of 900 MPa (130,000 psi) and a minimum ductility of 20%EL? If...
-
In February 1999, Boots, the leading retail chemist in the United Kingdom, announced plans to reform its employee option compensation scheme. In the future, it said, the firm will purchase its own...
-
The manager of Gladstone Ltd is not convinced of the scientific evidence behind climate change, and does not consider it necessary to adopt changes in the companys operations which would decrease its...
-
Read the article Security Controls that Work by Dwayne Melancon in the 2007 Issue, Volume 4 of the Information Systems Control Journal (available www.isaca.org/Journal/Past-Issues/2007/Volume-4...
-
On January 1, 2016, Theta Corp. acquired a four unit apartment building at as cost of $1,475,000. Of this total, it is estimated that the land on which the building is situated is worth $250,000 and...
-
Pricing has objective and subjective constraints when Marketing Managers must set a value based for the products and services they offer. Under which circumstances in pricing a newly launched product...
-
Dr. Taylor is preparing a budget that will be used to schedule the purchase of dental equipment, five computers, and surgical devices for the dental practice. What type of budget is Dr. Taylor...
-
Suppose a firm gives coupons to selected consumers that entitle them to price discounts. Why might the firm limit the number of coupons that a customer can use on a single purchase? Provide a working...
-
1. Write the time-complexities of operations/methods on data structures that are given below, in big-oh notation- write your answer next to the question. You can assume there are n items stored in...
-
You have been working in an infrastructure fund as an Investment Analyst for a year and have been assisting both the Investment and Asset Management teams in managing a township project in Bangkok....
-
E(CF1) = 1,000*0.4 2,000*0.5 4,000*0.1= 1,800. E(CF2) = 1,500*0.3 2,000* 0.6 6,000* 0.1 = 2,250. E(CF3) = 3,000* 0.2 3,000 * 0.4 5,000*0.4 = 3,800. E(NPV) = -4,000 1,800/1.1 2,250/1.12 3,800/ 1.13 =...
-
Vintage Poster comma Co.Vintage Poster, Co. are as follows: Requirements 1. Compute the predetermined overhead allocation rate per direct labor dollar. 2. Prepare the journal entry to allocate...
-
In the simple quantity theory of money, what will lead to an increase in aggregate demand? In monetarism, what will lead to an increase in aggregate demand?
-
An abstract class Dwelling has two subclasses, SingleFamily and MultiFamily. None of the constructors for these classes requires any arguments. Which of the following statements is legal? a. Dwelling...
-
You must always include ____________ in a for loops parentheses. a. Two semicolons b. Three semicolons c. Two commas d. Three commas
-
How many rows are contained in the following array? double[][] prices = { {2.56, 3.57, 4.58, 5.59}, {12.35, 13.35, 14.35, 15.00} }; a. 1 b. 2 c. 4 d. 8
-
Suppose a species of bacteria divides once every 20 minutes. You start with a single bacterium on your unrefrigerated egg-and-baloney sandwich at 8:00 am. Show that when you sit down to lunch at...
-
If two species belong to the same order, do they have to belong to the same class? Do they have to belong to the same genus?
-
The lightest and heaviest flying birds are the bee hummingbird of Cuba, which weighs about 1.6 grams, and the great bustard of Europe and Asia, which can weigh as much as 21 kilograms. Show that the...
Study smarter with the SolutionInn App