Write Java Program Calculates Area Square Takes Side Input Prints Side Area Along Units Pl Q43805164
Write a java program that calculates the area of a square, ittakes the side as input and prints the side and area along withunits.
Please post the copyable code along with output
Expert Answer
Answer to Write a java program that calculates the area of a square, it takes the side as input and prints the side and area along…
Write Java Program Called Minimum Demo According Following Specifications Code Contained M Q43859106

Write a Java program called Minimum Demo according to the following specifications: (All code is contained in your MinimumDemo class) 1. Main method o create a List and add the following values to that list: 5, 3, 7, 1 o call printMin method 2. Create a method called calculate Min 0 This method takes as its only argument the List of integer values that you created and populated in main o This method then returns the minimum of the numbers in the argument array or ArrayList o calculate the correct return value using a simple algorithm that you create (don’t just return the correct value by inspection or use a Java built-in routine) 3. Create a method called printMin that O prints the following to the console, exactly as shown 0 The minimum of the numbers [5, 3, 7, 1] is 1. Show transcribed image text Write a Java program called Minimum Demo according to the following specifications: (All code is contained in your MinimumDemo class) 1. Main method o create a List and add the following values to that list: 5, 3, 7, 1 o call printMin method 2. Create a method called calculate Min 0 This method takes as its only argument the List of integer values that you created and populated in main o This method then returns the minimum of the numbers in the argument array or ArrayList o calculate the correct return value using a simple algorithm that you create (don’t just return the correct value by inspection or use a Java built-in routine) 3. Create a method called printMin that O prints the following to the console, exactly as shown 0 The minimum of the numbers [5, 3, 7, 1] is 1.
Expert Answer
Answer to Write a Java program called Minimum Demo according to the following specifications: (All code is contained in your Minim…
Write Java Program Consists Definition Public Class Called Token Two Instance Variables On Q43816472
(a) Write a Java program that consists of a definition for apublic class called Token. There should be two instance variables.One should be of type char, and be named root. The other should bea one-dimensional array of Token, and be named multi. The classshould have one constructor with a formal parameter of type charnamed root. This constructor should use the “this” keyword toassign its actual parameter to the instance variable of the samename. The other constructor should take a String. This shouldcreate and assign to multi an array of Token, each element of whichis constructed on a distinct char from the specified String.(Remember that s.charAt(i) will return the i’th char from Strings.) [20 marks]
(b) Add a method to the class named getRandom(), which returns aToken. This should behave as follows. If the object on which themethod is called has a null value for its multi variable, it shouldreturn a Token constructed on the char ‘z’. If the multi variableis not null, the method should return one of the Token objects fromthe multi array selected at random. (Remember that Math.random()produces a random double value in the range 0.0..1.0.) [15marks]
(c) Write an additional method for the class defined above,named nMultis. This should take a char and return an int. Thebehavior of the method should be as follows. If the object’s multiarray is null, the method should return 0. Otherwise, it should gothrough the array to discover how many of the Token objects have avalue of the root variable identical to the method’s argument. Thisint value should then be returned. [15 marks]
Expert Answer
Answer to (a) Write a Java program that consists of a definition for a public class called Token. There should be two instance var…
Write Java Program Convert Power Kilowatts Kw Electric Car Motor Horsepower Hp Follows Pro Q43780834
Write a Java program to convert power in kilowatts (kW) of anelectric car motor to horsepower (hp) as follows:
Prompt the user to enter the power in kilowatts (kW) of theelectric car motor.
Convert the power to horsepower. In a comment, reference yoursource for the conversion factor (non-wiki source). (As a roughestimate, 1 hp equals ~0.75 kW.)
Output the power in horsepower (hp). Print the result with 2decimal places.
Once this is working, add a do-while loop such that, after thepower is displayed, the user sees:
“Repeat the calculation (Y/N)?: ”
If the user enters the character ‘Y’ or ‘y’, then repeat theprocess of requesting new user input, calculating and displayingthe converted power. If the user enters any other character, thenquit.
Expert Answer
Answer to Write a Java program to convert power in kilowatts (kW) of an electric car motor to horsepower (hp) as follows: Prompt t…
Write Java Program Convert Power Kilowatts Kw Electric Car Motor Horsepower Hp Follows Pro Q43786926
Write a Java program to convert power in kilowatts (kW) of anelectric car motor to horsepower (hp) as follows:
Prompt the user to enter the power in kilowatts (kW) of theelectric car motor.
Convert the power to horsepower. In a comment, reference yoursource for the conversion factor (non-wiki source). (As a roughestimate, 1 hp equals ~0.75 kW.)
Output the power in horsepower (hp). Print the result with 2decimal places.
Once this is working, add a do-while loop such that, after thepower is displayed, the user sees:
“Repeat the calculation (Y/N)?: ”
If the user enters the character ‘Y’ or ‘y’, then repeat theprocess of requesting new user input, calculating and displayingthe converted power. If the user enters any other character, thenquit.
Expert Answer
Answer to Write a Java program to convert power in kilowatts (kW) of an electric car motor to horsepower (hp) as follows: Prompt t…
Write Java Program Design Class Mentioned Picture Please Describe Codes Correct Solutions Q43838692
Write a JAVA program to designthe class mentioned in the picture. Please describe your codes.Correct solutions only please.
Given an array of windows in the plane, we want to count how many overlapping and how many enclosing pairs of windows there are (without double counting). A window is the region of the plane enclosed by a rectangle with sides parallel to the x and y axes. A window can be abstracted as an object with the 4 fields of doubles: (left, right, bottom, top). These fields should satisfy the invariant: left < right and bottom < top. The window is the Cartesian product of the x-interval (left, right) and the y-interval [bottom, top), i.e., the set of points (x,y) in the plane such that left <x<right and bottom <y<top. Consider a pair of windows w, and w,. We say these two windows overlap if they have a common interior point (just touching boundaries is not enough). We say w, encloses w, if no part of w, is outside wo. (Note that the first relationship is symmetric but the second is anti-symmetric.) Design a class called Window with the following fields and methods: (Note: you should not confuse this with the Java API class java.awt.Window.) • Protected fields left, right, bottom, top. • A constructor that throws an exception named InvalidWindowException if the given 4 fields do not satisfy the above invariant. Public getters and setters for these fields. The setters also throw Invalid WindowException if invalid field value is attempted to be set. • Boolean instance method encloses(Window w) returns true if and only if the instance window encloses the argument window w. • Boolean instance method overlaps(Window w) returns true if and only if the instance window overlaps the argument window w. • Static method overlapCount(Window[] windows) returns the number of (unordered) overlapping pairs of windows in the input array windows. Static method enclosureCount(Window[] windows) returns the number of (ordered) enclosing pairs of windows in the input array windows. main() method runs some interesting test cases of the above methods. Show transcribed image text Given an array of windows in the plane, we want to count how many overlapping and how many enclosing pairs of windows there are (without double counting). A window is the region of the plane enclosed by a rectangle with sides parallel to the x and y axes. A window can be abstracted as an object with the 4 fields of doubles: (left, right, bottom, top). These fields should satisfy the invariant: left
Expert Answer
Answer to Write a JAVA program to design the class mentioned in the picture. Please describe your codes. Correct solutions only pl…
Write Java Program Following Tasks Use Java Api Documentation Find Suitable String Methods Q43905345

Write a Java program to the following tasks. Use Java API Documentation to find suitable String methods to complete the tasks when needed. • Declare a String variable str. • Set the value of str to your complete name, one word for your first name (without space) and one word for your last name (without space), having one space between them, and all in lowercase. (Therefore, the format of the String str is something like “xxxxXX XXXXXXxxxx”.) Display the value of str. Display the length of str. • Extract your first name from str and put it into another String variable, called firstName. Do the same for your last name and put it into a String variable, called lastName. • Declare another String variable, str2, and initialize it with lastName, a comma, a space and then firstName. • Display str2. • Display the position (index) of the first occurrence of the last character of your lastname in your firstname. • Display the position (index) of the last occurrence of the first character of your lastname in your firstname. • Replace the first character of the firstName variable with its uppercase and put it back into firstName variable. • Do the same for lastName. • Display firstName and lastName. *Note that you are not allowed to use fixed numbers to apply the requested tasks. This means that when you do the tasks, assume that you don’t exactly know the exact contents of the variables. Activity 2. Follow the steps to implement a class for the following requirements’ specification: Alice wants to store the information of all her books. She would like to be able to create new book by giving its name as the mandatory value. Sometimes she creates new book by indicating name and author. Except name and author, any book can have year of publication and number of pages. Alice wants to have the following functionalities as well: 1- Get the name of a book 2- Get the author of a book 3- Get the year of publication of a book 4- Get the number of pages of a book 5- Set/change each of the information of a book Having the above requirements, provide a Java class for Alice, named Book, by using all the steps we learned in order Show transcribed image text Write a Java program to the following tasks. Use Java API Documentation to find suitable String methods to complete the tasks when needed. • Declare a String variable str. • Set the value of str to your complete name, one word for your first name (without space) and one word for your last name (without space), having one space between them, and all in lowercase. (Therefore, the format of the String str is something like “xxxxXX XXXXXXxxxx”.) Display the value of str. Display the length of str. • Extract your first name from str and put it into another String variable, called firstName. Do the same for your last name and put it into a String variable, called lastName. • Declare another String variable, str2, and initialize it with lastName, a comma, a space and then firstName. • Display str2. • Display the position (index) of the first occurrence of the last character of your lastname in your firstname. • Display the position (index) of the last occurrence of the first character of your lastname in your firstname. • Replace the first character of the firstName variable with its uppercase and put it back into firstName variable. • Do the same for lastName. • Display firstName and lastName. *Note that you are not allowed to use fixed numbers to apply the requested tasks. This means that when you do the tasks, assume that you don’t exactly know the exact contents of the variables. Activity 2. Follow the steps to implement a class for the following requirements’ specification: Alice wants to store the information of all her books. She would like to be able to create new book by giving its name as the mandatory value. Sometimes she creates new book by indicating name and author. Except name and author, any book can have year of publication and number of pages. Alice wants to have the following functionalities as well: 1- Get the name of a book 2- Get the author of a book 3- Get the year of publication of a book 4- Get the number of pages of a book 5- Set/change each of the information of a book Having the above requirements, provide a Java class for Alice, named Book, by using all the steps we learned in order
Expert Answer
Answer to Write a Java program to the following tasks. Use Java API Documentation to find suitable String methods to complete the …
Write Java Program Print Following Pattern Squared Use Nested Loop 5 45 345 2345 12345 Get Q43868232
write a java program that will print out the following patternbut squared. Use nested for loop
5
45
345
2345
12345
to get
25
16 25
9 16 25
4 9 16 25
1 4 9 16 25
Expert Answer
Answer to write a java program that will print out the following pattern but squared. Use nested for loop 5 45 345 2345 12345 to g…
Write Java Program Print Following Pattern Use Nested Loop 5 45 345 2345 12345 Q43868194
write a java program that will print out the following pattern.Use nested for loop
5
45
345
2345
12345
Expert Answer
Answer to write a java program that will print out the following pattern. Use nested for loop 5 45 345 2345 12345…
Write Java Program Read Add Two Numbers Type Integer Display Result Q43789305
Write a JAVA program to read and then add two numbers typeinteger and display the result.
Expert Answer
Answer to Write a JAVA program to read and then add two numbers type integer and display the result. …