Assignment 1 1. Write a program to implement the following formula for a -10 and b...
Fantastic news! We've Found the answer you've been seeking!
Question:
![image](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/01/65b7841d08ca2_72465b7841cdfab9.jpg)
Transcribed Image Text:
Assignment 1 1. Write a program to implement the following formula for a -10 and b = 4; result = (a + 2b - 4ab)^4 // ^4 means to the power of 4 (1 mark) 2. Write a program to implement result = sin (PI / 3) * tan (PI / Use the double data type. 4) (1 mark) 3. Write a program to count the sum of integers from 10 to 20. Use a for loop. (1 mark) 4. Do question 3 using a while loop. (1 mark) 5. Write a program to find the sum of all odd integers starting from 11 to 21, inclusive. Your program should count 11 +13 + 15 + (2 marks) + 21. 6. Do question 5 using even numbers from 10 to 20. (2 marks) 7. Find the volume of a cylinder with radius 2 and height of 4. Remember that V = PI rr height () (4 marks) 8. Imagine you work 8 hours from Monday to Thursday, 6 hours on Friday, 4 hours on Saturday, and you are off on Sunday. Write a program to accept the day index as an integer from the user and display the hours. In a while loop continuously ask the user and display the hours worked. Terminate the program when the user enters an index outside 0-6. Use a switch statement; do not use an if-else structure. Here is an example of how a user interacts with your program: Program: Please enter a day index. Use 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. User : 2 Program: You work 8 hours on Tuesdays. Program: Please enter a day index. Use 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. User : -1 Program: Program terminating. (8 marks) Assignment 1 1. Write a program to implement the following formula for a -10 and b = 4; result = (a + 2b - 4ab)^4 // ^4 means to the power of 4 (1 mark) 2. Write a program to implement result = sin (PI / 3) * tan (PI / Use the double data type. 4) (1 mark) 3. Write a program to count the sum of integers from 10 to 20. Use a for loop. (1 mark) 4. Do question 3 using a while loop. (1 mark) 5. Write a program to find the sum of all odd integers starting from 11 to 21, inclusive. Your program should count 11 +13 + 15 + (2 marks) + 21. 6. Do question 5 using even numbers from 10 to 20. (2 marks) 7. Find the volume of a cylinder with radius 2 and height of 4. Remember that V = PI rr height () (4 marks) 8. Imagine you work 8 hours from Monday to Thursday, 6 hours on Friday, 4 hours on Saturday, and you are off on Sunday. Write a program to accept the day index as an integer from the user and display the hours. In a while loop continuously ask the user and display the hours worked. Terminate the program when the user enters an index outside 0-6. Use a switch statement; do not use an if-else structure. Here is an example of how a user interacts with your program: Program: Please enter a day index. Use 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. User : 2 Program: You work 8 hours on Tuesdays. Program: Please enter a day index. Use 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on. User : -1 Program: Program terminating. (8 marks)
Expert Answer:
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
How does a healthcare organization ensure that they are meeting their regulatory obligations? Post your thoughts and respond to two classmates. PLEASE PROVIDE SOURCES
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
The following are some examples of typical business transactions: 1. Purchased office equipment on credit. 2. The owner contributed capital. 3. Purchased office furniture for cash. 4. Received...
-
When 3-chlorocyclopropene is treated with AgBF4.AgCl precipitates. The organic product can be obtained as a crystalline material, soluble in polar solvents such as nitromethane but insoluble in...
-
In obtaining confirmations from law firms, Betty Chui's aim is to receive the confirmation letters as early as possible after the balance sheet date. This provides her with a signed letter from every...
-
Why is this important? If the issue price is above the current market price, it would be cheaper for the investor to buy shares in the open market (assuming transaction costs are not significant)...
-
Metallica Can Opener Company is a subsidiary of Maltz Appliances, Inc. The can opener that Metallica produces is in strong demand. Sales this year are expected to be 1,000,000 units. Full plant...
-
Concord plc had the following investment portfolio at January 1, 2022. Evers Company 990 shares @ 14 each E13,860 Rogers Company 900 shares E18 each 16,200 Chance Company 500 shares E9 each 4,500...
-
The MN plant manufactures two different products: M and N. Selling prices and weekly market demands are shown in the following diagram. Each product uses raw materials with costs as shown. The plant...
-
A) According to established logic, increased prices should decrease sales, but wines seem to contradict this. What role does behavioral economics play in wine pricing? What type of cue might be...
-
Think back to a time you experienced a communication breakdown in a personal or social setting (something you're comfortable discussing with the class in a public forum). 1. Did you figure out why...
-
Imagine you are visiting your aunt, who is a patient in a hospital in a nearby city. While you are sitting at her bedside, you hear a lot of noise at the nurses' station, as if they are having a...
-
Using Houseplan #5 on page 4 of the Measurement supplement(below), determine the cost of pouring the 9 inch thick concreteslab for this home, assuming that the porch will also be on thefoundation....
-
Recall from lecture that Flip-Flap Railway is an old roller coaster that was built in a circle. It has a diameter of 25 ft and riders entered the ride at a speed of 45 mph. At the top of the loop,...
-
Small Fry Design, founded in 1997, is a toy and accessories company that designs and imports products for children. The company's line of merchandise includes teddy bears, musical toys, rattles and...
-
Two characteristics that make owning stock attractive are: unlimited liability and first claim on assets. share prices are relatively inexpensive and are transferable. each share represents a large...
-
To balance the chemical equation SiH3 + O2 SiO2 + HO, you could introduce coefficients a, b, c, d and write aSiH3 + bO2 cSiO + dHO then write linear equations for each element. The equation for Si...
-
Identify two constraints in accounting. AppendixLO1
-
A medium-sized UK-based insurance company underwrites mainly commercial and industrial property and motor and liability insurance. Outline, with reasons, the types of reinsurance it is likely to buy...
-
If the present value of $1.00 received N years from today at an interest rate of int% is 0.270, what is the future value of $1.00 invested today at an interest rate of int% for N years? a. $1.00 b....
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App