Create a class named Square that contains data fields for height, width, and surfaceArea, and a method named computeSurfaceArea(). Create a child class named Cube. Cube contains an additional data field named depth, and a computeSurfaceArea() method that overrides the parent method. Write an application that instantiates a Square object and a Cube object and displays the surface areas of the objects. Save the files as Cube.java, Square.java, and DemoSquare.java.
Q: Design and implement a class called BankAccount. A BankAccount has ID, owner(Client Name)…
A: Class Name : BankAccount Data Members ID owner branch balanceInJD balanceInNIS Methods :…
Q: add four more shape classes, Pyramid4 a 4-sided pyramid, Pyramid3 a 3-sided pyramid, Square, and…
A: Define Pyramid4 class to implement the 4-sided pyramid. Define Pyramid3 class to implement the…
Q: Read an array A of integer numbers (negative and positive). Find two A[i]*A[i+1]*...*A[j] is…
A: Algorithm: 1. START 2. Initialize maximum product variable to 0 3. Initialize two indices i and j to…
Q: Define a method named getWordFrequency that takes an array of strings, the size of the array, and a…
A: ANSWER:-
Q: Create a GUI application that allows the user to select a rate category (from a set of radio…
A: According to the information given:- We have to create GUI application that allows user to enter the…
Q: Calculate water bill based on water consumption as given below: Rate (RM/m³) Minimum Charges (RM)…
A: Please find the answer below :
Q: import java.util.Scanner; 3 public class Compare { public static void main(String args) { final int…
A: Answer :
Q: Hold-at-20 Turn Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100…
A: In this question we have to write a Java program to simulate the pig game which is known as hold at…
Q: 1 import java.util.Scanner; 2 -3 public class LabProgram { public static void main(String args) { /*…
A: PROGRAM INTRODUCTION: Import the required libraries. Start the definition of the main function.…
Q: Calculate and display Body Mass Index (BMI) based on weight in kilograms and height in meters…
A: Background:- Here if else condition is used to check the category of BMI. once a category is…
Q: Given a sorted list of integers, output the middle integer. A negative number indicates the end of…
A: According to the information given:- we have to find middle term of given sorted list in java.
Q: In this assignment you will write a program to find the mean of a list of grades stored in a file.…
A: Required: In this assignment you will write a program to find the mean of a list of grades stored in…
Q: Write a program that repeatedly reads in integers untila negative integer is read. The program also…
A: 1) Below is Java program that repeatedly reads in integer until negative integer is read. It track…
Q: Given sphereRadius, compute the volume of a sphere and assign sphereVolume with the result. Use…
A: For calculating The volume of sphere Formula is = (4.0/3.0) * π * r3 For PI value, there is…
Q: Temp Converter Create a program that will allow the user to input a temperature in either °C or °F,…
A: Here I have created a function named celsiusToFahrenheit() that converts temperature to Fahrenheit…
Q: Create a class named Book. The class have the following instance data members: o Book name o ISBN…
A:
Q: Write a single java program by taking two variables num1 and num2 with values of your own and…
A: Code public class Main{ public static void main(String[] args) { int num1=4,num2=5;…
Q: use java to a program that displays all the leap years, eight per line, from 101 to 2500, separated…
A: Please find the answer below
Q: 2.45 LAB: Divide input integers Write a program using integers userNum and divNum as input, and…
A: Import the Scanner class to read input from the user. Declare integer variables userNum and divNum…
Q: 5. Theater Revenue A movie theater only keeps a percentage of the revenue earned from ticket sales.…
A: Below is the required code and sample output:
Q: county collects property taxes on the assessment value of property, whic f the property's actual…
A: Solution :
Q: Exercise 1 (Recursive Fibonacci) Make a new Java Project called Lab5. Then create a new class called…
A: In Fibonacci series the next number is the sum of previous two numbers. Example: 0, 1, 1, 2, 3, 5,…
Q: I need help solving this in JAVA
A: Solution Programming language used: Java Program code - (Note: all necessary comments are…
Q: 6) Class Circle is a subclass of Shape class; and the Circle class has one attribute for the radius…
A: public class Shape { private String color; public Shape(String color) { this.color…
Q: Write a program that reads a list of integers and outputs those integers in reverse. The input…
A:
Q: Write a program that first gets a list of integers from input. The input begins with an integer…
A: Below is the code in java and sample output:
Q: solve
A: We need to define a method getRowSum() as per given description
Q: Repetition Structures Debugging Exercises A1. Find the error in the following pseudocode. Declare…
A: Given:- Find the error in the following pseudocode.
Q: Calculate electricity bill based on the following tariff: Tariff Unit Rate For the first 200 kWh (1…
A: 1 RM = 100 Sen Finally, the output is displayed with 2 point precision and initially, the amount…
Q: Use scnr.next() to read strings from input until "bathrobe" is read. If the string read from input…
A: 1. Import the necessary `Scanner` class from the `java.util` package.2. Define a `public class`…
Q: The alligator tries to find the way to the river. 1 presents path, 0 presents non-path. Please write…
A: In this question, it is asked to provide the java code for the given problem statement. The problem…
Q: You have an array of N integers. You need to make this array good. An array A1,A2,A3... AN…
A: Let cnt0 be the number of subsequences of [0], cnt1 be the number of subsequences [0, 1], cnt2 — the…
Q: Write a program that takes in three integers and outputs the largest value. Ex: If the input is: 1 2…
A: Algorithm: Start Read 3 numbers a,b,c If a>b and a>c, print largest number is a Else if…
Using java, solve the problem.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images
- create an image file programmatically. Your image file should be called OnTheFlyPy.ppm and the code you write to create should be in a public static void makePPM() method defined in the provided Main.java class. Your OnTheFlyPy.ppm should be be 100 pixels wide and 100 pixels tall and the PPM header lines should be correct. The first two rows and last two rows in the OnTheFlyPy.ppm should be red (Red=255, Green=0, Blue= 0). The first two columns and last two columns in the OnTheFlyPy.ppm (except for the part that overlaps with the red pixels you created in the previous part) should should be blue (Red=0, Green=0, Blue= 255). The remaining pixels in your OnTheFlyPy.ppm image should be white (Red=255, Green=255, Blue= 255). Here is a picture of what your final image should look like: import java.io.*; public class Main{ public static void main(String[] args) { makePPM(); } public static void makePPM() { } }Create a program that uses classes, polymorphism, and enums to monitor blizzards in Europe, with class members including the blizzard name, location, and snowfall amount, with a continuous menu to update, delete, display, search and add data stored in a collection. The application should have a menu that allow users to: • Add a new item to the collection. • Display all the items in the collection. • Search for a specific item. • Exit the application by pressing 0. The application should also display any error messages if the user enters invalid input. Coding Requirements: 1. Demonstrate applied use of foreground color and change in console title 2. Classes created and apply generics, abstract, and polymorphismCreating Enumerations In this section, you create two enumerations that hold colors and car model types. You will use them as field types in a Car class and write a demonstration program that shows how the enumerations are used. 1. Open a new file in your text editor, and type the following Color enumeration: enum Color {BLACK, BLUE, GREEN, RED, WHITE, YELLOW}; 2. Save the file as Color.java. 3. Open a new file in your text editor, and create the following Model enumeration: enum Model {SEDAN, CONVERTIBLE, MINIVAN}; 4. Save the file as Model.java. Next, open a new file in your text editor, and start to define a Car class that holds three fields: a year, a model, and a color. public class Car { private int year; private Model model; private Color color; 5. Add a constructor for the Car class that accepts parameters that hold the values for year, model, and color as follows: public Car(int yr, Model m, Color c) { year = yr; model = m; color = c; } 6. Add a display()…
- Open the Palace Solution.sln file contained in the VB2017\Chap10\Palace Solution folder. Use Windows to copy the Rectangle.vb file from the VB2017\Chap10 folder to the Palace Project folder. Then, use the Add Existing Item option on the Project menu to add the file to the project. Modify the Rectangle class to use Double variables rather than Integer variables. Change the name of the GetArea method to GetAreaSqFt. Add another method to the class. Use Get AreaSqYds as the method’s name. The method should calculate and return the area of a rectangle in square yards. The application’s Calculate button should calculate and display the number of square yards of carpeting needed to carpet a rectangular floor. Code the btnCalc_Click procedure. Display the number of yards with one decimal place. Save the solution and then start and test the application.Picture card: Create a picture card that looks SIMILAR to this. There are images available in the "images" directory to assist you in making this card. They are not the same images, but there is an image of a desert and a person. Picture card In this screenshot, the title is "Title goes here", the secondary text is "Secondary text", and the body text is "Greyhound divisively hello coldly wonderfully marginally far upon excluding." The card's root element is a with a class of "card". The card is 344px wide. The desert picture is 194px tall. The padding between the body text and everything else is 16px. The color of the title text is #000. The color of the secondary and body texts is #232F34. The size of the person picture is 40px in diameter. The size of the body text is 11px. The size of the title is 22px. For the padding or margin around any other elements, use your best judgment to make it look like the screenshot.1. Create an interface named Turner, with a single method named turn(). Create a class named Leaf that implements turn() to display Changing colors. Create a class named Page that implements turn() to display Going to the next page. Create a class named Pancake that implements turn() to display Flipping. Write an application named DemoTurners that creates one object of each of these class types and demonstrates the turn() method for each class. Save the files as Turner.java, Leaf.java, Page.java, Pancake.java, and DemoTurners.java. Think of two more objects that use turn(), create classes for them, and then add objects to the DemoTurners application, renaming it DemoTurners2. java. Save the files, using the names of new objects that use turn()
- Create another class called WordGUI that will be a complete JFrame with a menu bar and menus. There should be two menus: one called File and another called List. The File menu should have the menu items Open and Quit. The List menu should have five menu items: A, E, I, O, U. The content pane of the GUI should have a grid layout of one row and two columns. Clicking on File > Open should allow the user to choose a file. That file should be displayed in the left column, with the lines numbered (starting at 1). When the user clicks on List a choice can be made of one of the five vowels. Clicking on a vowel should list all the words starting with that vowel in sorted order in the right column. Each word should have the line number on which it appeared. Create a class to record the word and its line number Create a class called WordLine that will have two instance variables: a String for the word, and an int for the line number on which the word appears. There should be a two-argument…Extra 7-2 Add a stopwatch to the Clock application In this exercise, you’ll add a stopwatch feature to a digital clock application. The stopwatch will display elapsed minutes, seconds, and milliseconds. 1. Open the application in this folder: exercises_extra\ch07\clock_stopwatch\ 2. In the JavaScript file, note the $(), displayCurrentTime(), padSingleDigit(), and DOMContentLoaded event handler functions from the Clock application. In addition, note the global variables and starting code for the tickStopwatch(), startStopwatch(), stopStopwatch(), and resetStopwatch() functions. 3. In the tickStopwatch() function, add code that adds 10 milliseconds to the elapsedMilliseconds variable and then adjusts the elapsedMinutes and elapsedSeconds variables accordingly. Then, add code that displays the result in the appropriate span tags in the page. 4. In the startStopwatch() function, add code that starts the stopwatch. Be sure to cancel the default action of the link too. 5. In the…Given an input file of dates represented as Strings, read the dates from the file and display them in a GUI. The dates will be in the form yyyymmdd (such as 20211001 for October 1, 2021). The GUI should have a GridLayout with one row and two columns. The left column should display the dates in the format read from the file, and the right column should display the dates as Date212 object in sorted order (using Selection Sort).
- JavaScript Assignment For this assignment you are only to use external CSS and JavaScript. This assignment shouldhave no templates or frameworks. The Fruits to be used are Apple, Orange, Pear, and Pineapple. Write the code in a way that allows it to pull the images from a folder inside the main folder named “images." The file names are as follows Apple.png, Orange.png, Pear.png, and Pineapple.png. You are to create a child's game. The game will have a title in the head of the boilerplate withyour name. The name of the game will be Fruit Game which will need to be included in theheader of the browser using a h1 element. You will display an image of a fruit. Under the imagethere will be room for text for the name of the fruit but not displayed at the start. You will havefour buttons with names for the fruits available. When the button with the fruit name is clickedthe name of the fruit will appear under the image of the fruit. If the button and the name of thefruit is the same then you…Create a Simple Swing application with the following properties: Import the Java package that contains all the classes we require to create swing app. Create a class called examSwing with private access specifier and do the following in the constructor of this the class. Create an object of the frame class and pass "Exam Pressure" to its constructor. Call the frame frmExam. Prevent the user from maximizing the frmExam frame. Set the width of frmExam to 300 pixels, and its height 200pixels Indicate that when the user clicks on the close button on frmExam, the frame should exit. Create an object ofthe label class. Call it lblexam and set its text to "Exam Fever" Position the lblexam 150pixels and 50pixels on the X and Y axis with a width and height of 100pixels and 20pixels respectively. Add lblexam to frmExam. Set the visibility property of frmExam to true.Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and their sum. The SalesTransaction class contains the following fields: Name - The salesperson's name (as a string) salesAmount - The sales amount ( as a double) commission - The commission (as a double) RATE - A readonly field that stores the commission rate (as a double). Define a getRate() accessor method that returns the RATE Include three constructors for the class. One constructor accepts values for the name, sales amount, and rate, and when the sales value is set, the constructor computes the commission as sales value times commission rate. The second constructor accepts a name and sales amount, but sets the commission rate to 0. The third constructor accepts a name and sets all the other fields to 0. An overloaded + operatoradds the sales values for two SalesTransaction objects and returns a new SalesTransaction object. In order to prepend the $ to…