In this lab assignment, you are asked to write java code of given classes in the following class diagram You are given an UML diagram that expresses relationship between three classes. Circle class is the parent class of the Curve and Cylinder classes.

In this lab assignment, you are asked to write java code of given classes in the following class diagram. You are given an UML diagram that expresses relationship between three classes. Circle class is the parent class of the Curve and Cylinder classes. Also, you are given Circle.java and testlnheritance.java files. Examine the given UML diagram and code. 1) Add variable definitions to the Circle class. Be careful about accessibility modifiers given in the UML 2) Implement the getArea method. The method will initially print the message: name of the class + "getArea method is invoked". Then, it will calculate and return the area of the circle by the formula area =πr2. Note: You can retrieve the name of the class by this.getClass(). getSimpleName(). 3) Implement Curve and Cylinder classes as given in the UML diagram. a. getArea method in the Curve and Cylinder class will initially print the message: name of the class + "getArea method is invoked". b. Then, it will calculate the area of the object and return it. c. Area formulation for cylinder: A=2πr(h+r) ( h stands for height) d. Area formulation for curve: A=(α/360)πr2 ( α stands for angle) e. draw method of Curve and Cylinder classes will initially call the parent class' draw method. Note: Your can access the method of the parent class by super.method() f. Then, it will print one of the following strings: "This method is overloaded with an double parameter the value is: " + val "This method is overloaded with an int parameter the value is: " + val 4) Complete the testinheritance class to produce the following output. Add calls to getArea and draw methods and print the calculated areas. Note: Do not forget to add variable definitions and implement getters and setters in all classes. Expected Output: Circle getarea method is invoked Circle area value is: 78.5 Cylinder getarea method is invoked Cylinder area value is: 351.68 Curve getarea method is invoked Curve area value is: 2.3549999999999995 Circle draw method is invoked cylinder draw method is invoked Cylinder draw method is invoked This method is overloaded with an int parameter the value is: 20 Curve draw method is invoked Curve draw method is invoked Curve draw method is invoked This method is overloaded with an double parameter the value is: 10.8

In this lab assignment, you are asked to write java code of given classes in the following class diagram. You are given an UML diagram that expresses relationship between three classes. Circle class is the parent class of the Curve and Cylinder classes. Also, you are given Circle.java and testlnheritance.java files. Examine the given UML diagram and code. 1) Add variable definitions to the Circle class. Be careful about accessibility modifiers given in the UML 2) Implement the getArea method.

Read More

Using best practises in programming, design and develop a project based on the following requirements: Ask the user how many words they would like to type

Directions: Using best practises in programming, design and develop a project based on the following requirements: 1. Ask the user how many words they would like to type 2. Let the user input the words 3. Print the words one by one with their respective frequencies 4. Ask the user if they want to repeat. If they say yes, repeat the steps. If not, end the program. • Assume the program only allows up to 20 words • The program may read the number of words and words all in the same line or separate lines Purpose: To demo the knowledge and use of loops and conditional statements, functions and array structures. To think and select the proper loop to accomplish different tasks. Throughout the program, pay attention to variable definitions, data types, initializations, and all other...

Directions: Using best practises in programming, design and develop a project based on the following requirements: 1. Ask the user how many words they would like to type 2. Let the user input the words 3. Print the words one by one with their respective frequencies 4. Ask the user if they want to repeat. If they say yes, repeat the steps. If not, end the program. • Assume the program only allows up to 20 words • The program may read the number of words and words all in the same line or separat

Read More

Upon running the program, it should welcome the user to your Ice Cream shop and assign them a random order number.

Directions: Using best practises in programming, design and develop a project based on the following requirements: 1. Upon running the program, it should welcome the user to your Ice Cream shop and assign them a random order number. (randomly generated by the system.) 2. Next, it should ask the user if they want ice cream on a cone or cup. 3. Ask them for the number of scoops. Limit the maximum number of scoops to three. 4. Ask them for the flavour of the ice cream for each scoop they selected. For the scope of this program, please limit the options to three. 5. Ask them if they want any toppings. For this program, please limit the possible toppings to three. 6. Come up with an algorithm to set prices based on the user's choices. 7. Recap the order. If the user confirms, thank them and display that the order was placed. 8. Based on user selected options display a total (with tax and tips). Display this summary including order number. 9. Ask the user if they want to place another order. If they say yes, repeat the steps. If not, end the program. Purpose: To demo the knowledge and use of loops and conditional statements. To think and select the proper loop to accomplish different tasks. Throughout the program, pay attention to variable definitions, data types, initializations, and all other good programming practices.

Directions: Using best practises in programming, design and develop a project based on the following requirements: 1. Upon running the program, it should welcome the user to your Ice Cream shop and assign them a random order number. (randomly generated by the system.) 2. Next, it should ask the user if they want ice cream on a cone or cup. 3. Ask them for the number of scoops. Limit the maximum number of scoops to three. 4. Ask them for the flavour of the ice cream for each scoop they selected.

Read More

Write Python code to compute the value of the Boolean expression that checks whether a point with coordinates (5, 5) is inside a circle with center (0,0) and radius 7.

Write Python code to compute the value of the Boolean expression that checks whether a point with coordinates (5, 5) is inside a circle with center (0,0) and radius 7.

Write Python code to compute the value of the Boolean expression that checks whether a point with coordinates (5, 5) is inside a circle with center (0,0) and radius 7.

Read More

Write a C++ program that asks the user to enter the coupon color and the haircut type (adult, kid) and then determine the haircut charge.

Write a C++ program that asks the user to enter the coupon color and the haircut type (adult, kid) and then determine the haircut charge. It is possible that a customers may not have a coupon, in that case, no discount will be offered. You can assume that green, blue colors are represented using 1 and 2 respectively. Write the program so it will generate the output as shown in the sample runs below where user input is in bold. Without coupons adult haircut is 15.50 and the child haircut is 10.50. Sample Run 1 Enter coupon color(θ=no coupon,1=green,2=blue):1 Enter the type of haircut (a=adult ork=kid):a The charge is 12.00

Write a C++ program that asks the user to enter the coupon color and the haircut type (adult, kid) and then determine the haircut charge. It is possible that a customers may not have a coupon, in that case, no discount will be offered. You can assume that green, blue colors are represented using 1 and 2 respectively. Write the program so it will generate the output as shown in the sample runs below where user input is in bold. Without coupons adult haircut is 15.50 and the child haircut is 10.50

Read More

Write a program to takes in width, height and length of a box and calculate the volume of the box. Display the volume

1. Write a program to takes in width, height and length of a box and calculate the volume of the box. Display the volume. Volume of box = width x height x length 2. When Azmi began his trip from Johor Bahru to Alor Setar, he filled his car's tank with gas and reset its trip to zero. After travelling for 234 miles, Azmi stopped at a gas station to refuel; the gas tank required 15 gallons. Create a program that Azmi can use to display his car's mileage - number of miles his car can be driven per gallon of gas at anytime during the trip.

1. Write a program to takes in width, height and length of a box and calculate the volume of the box. Display the volume. Volume of box = width x height x length 2. When Azmi began his trip from Johor Bahru to Alor Setar, he filled his car’s tank with gas and reset its trip to zero. After travelling for 234 miles, Azmi stopped at a gas station to refuel; the gas tank required 15 gallons. Create a program that Azmi can use to display his car’s mileage – number of miles his car can be driven per g

Read More

Define a function trophiclevelindex(chla , tn, tp) that takes values for Chorophyll-a (CHLA), Total Nitrogen (TN), and Total Phosphorus (TP) and returns the Trophic Index (TLI3) using the calculation below.

Define a function trophic_level_index(chla , tn, tp) that takes values for Chorophyll-a (CHLA), Total Nitrogen (TN), and Total Phosphorus (TP) and returns the Trophic Index (TLI3) using the calculation below. The TLI3 is calculated as the average of the three transformed values, where each value is transformed as follows: tlc = 2.22 + 2.54 ∗ log10​CHLA tln = −3.61 + 3.01 ∗ log10​TN tlp = 0.218 + 2 .92 ∗ log10​TP ​For example, if CHLA = 10, TN = 100, and TP = 1000, then: tlc = 2.22 + 2.54 ∗ 1 = 4.76 tln = −3.61 + 3.01 ∗ 2 = 2.410 tlp = 0.218 + 2.92 ∗ 3 = 8.978 and TLI3 = 5.383 (to 3 decimal places) Notes: - The notation log10​x means the logarithm to base 10 of x, i.e. the power to which 10 must be raised to yield x. - In Python, log10​x can be calculated (after importing the math module) as math.log(x, 10) - You can assume that CHLA, TN, and TP values are positive, i.e. greater than 0. - Your function should not round its result. - TN, TP, and CHLA are commonly used variable names in the literature, so you can use the following variable names in your code in this assignment: tn, tp, and chla (note they are lower case).

Define a function trophic_level_index(chla , tn, tp) that takes values for Chorophyll-a (CHLA), Total Nitrogen (TN), and Total Phosphorus (TP) and returns the Trophic Index (TLI3) using the calculation below. The TLI3 is calculated as the average of the three transformed values, where each value is transformed as follows: tlc = 2.22 + 2.54 ∗ log10​CHLA tln = −3.61 + 3.01 ∗ log10​TN tlp = 0.218 + 2 .92 ∗ log10​TP ​For example, if CHLA = 10, TN = 100, and TP = 1000, then: tlc = 2.22 + 2.54 ∗ 1 =

Read More