Create a "tank" class and use it in a program that accepts height and radius from the user and prints total volume in cubic feet, total volume in gallons, and total weight of the water in pounds. Also print the surface area of the top of the tank, the surface area of the outside of the tank, and the total of these two areas in case you need to paint the tank (in square feet). So, the only inputs the class would need is the height and radius of the tank in feet. (python)
Q: Write a class that prompts the user for the day’s high and low temperatures. If the high is greater…
A: Step 1:- Note:-I am writing the program in the java language Program Approach:- Import the…
Q: Java I have to create a program with two classes that prompts a cashier to enter price, quantity,…
A: The given is a requirement to be written in Java which will have 2 classes: Item: To store the…
Q: Write a program that use two classes. Calculate the factorial of a given number by using one class…
A: Constructors are the functions which have same name as class name and whenever an instance is…
Q: You must write tests for the following: BankAccount Class Constructing a Bank…
A: BankAccount.java public class BankAccount { private String accountID; private double balance;…
Q: Create a new class called Simplecalc. In this class, implement a program that asks the user to enter…
A: // Java program for simple calculator import java.io.*;import java.lang.*;import…
Q: Implement the design of the Avengers class so that the following output is produced: [You are not…
A: Here I have first of all created the class named Avengers. In this class, I have created a…
Q: Write a program by creating an 'Employee' class having the following methods and print the final…
A: /* Java program */import java.util.*; class EmployeeDetail { private String name; private float…
Q: Given class Triangle, complete the program to read and set the base and height of triangle1 and…
A: You have to accept input from user rather than hardcoding and this is what we replaced here…
Q: might not be reasonable to expect users to type long entries such as “oil change” accurately.…
A: import java.util.Scanner; public class CarCareChoice2 { public static void main(String[] args) {…
Q: Consider the class Temperature below which has a static variable. What is the output of the main…
A: - We have to select the temperature which the code provides. - The options :: First option…
Q: have no idea what to do. Modify the FitnessTracker class, created in Chapter 4 Programming Exercise…
A: TestFitnessTracker2.java package bartleby; import java.time.*;public class…
Q: Your task is to write a program that computes paychecks. Employees are paid an hourly rate for each…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: Write a program that models 2 vehicles (Car and Truck) and will be able to simulate driving and…
A: This is an object oriented programming concept in which concepts like inheritance, polymorphism are…
Q: 1. Write a program that prompts the user to input the height and the radius of the base of a…
A: Program code: //importing required data package import javax.swing.*; //class public class…
Q: Write a program by creating an 'Employee' class having the following functions and print the final…
A: Required: To Write a program by creating an 'Employee' class having the following functions and…
Q: The following methods should output simple text messages on the screen for feedback, when…
A: As the student only asked about the plane class. Im Providing the Plane Class in Java Program below:
Q: Implement the design of the Travel class in python so that the following output is produced: You…
A: Algorithm: Start Implement class Travel with a static variable count and class variables…
Q: Write a class, AgeMessages , which does the following:a. Ask the user to enter age using a Scannerb.…
A: The algorithm for the program would be as below:Declare one float variable for accepting user…
Q: Write a class, NumberToMonth, which does the following:a. Ask the user to enter the month of the…
A: The algorithm for the program would be as below:Declare one int variable for accepting user…
Q: write a program to print the names of the student by creating a student class .if no name is passed…
A: Using Constructor #include <iostream> using namespace std; class Student{ public: string…
Q: This program will have 4 states: HAPPY, HUNGRY, BORED, SAD. Here are the rules. Our animal starts…
A: Please refer to the following steps for the complete solution to the problem above.
Q: write a discount system for a beauty saloon using java program, which provides services and sells…
A: public class Customer { private String name; private boolean member; private String…
Q: In this assignment, you will need to design and implement a class Country (Country.java) that stores…
A: Actually, program is a executable software that runs on a computer.
Q: In this exercise, you are going to create the Problem class. The Problem class is used to help…
A: Given code:- import java.util.*;class ProblemTester{String x;ProblemTester(String op,int min,int…
Q: Construct an OOP using classes and objects to find the distance travelled by a Vehicle in t" seconds…
A: Logic: Create class and create object. Declare members of the program. Call the method using the…
Q: Write a class in java with the name AgeMessages , which does the following:a. Ask the user to enter…
A: The algorithm for the program would be as below:Declare one float variable for accepting user…
Q: Write a program to find the average of three scores. Use one class for each score.
A: Please refer below for your reference: According to question ,I have used a class and a method…
Q: Create a class in the project Lab1 called Lab1b. Write a program to produce the song output below: 5…
A: Here I have created a loop to generate numbers from 5 to 1 using a reverse for loop. Inside the…
Q: Write a program to print the names of books by creating a book class. If no name is passed while…
A:
Q: This time we want the Animal greeting method to be modified so that it will be: Hello, my name is…
A: It is defined as programs can be asked from control statements, array, string, oops etc. Java basic…
Q: This may make more sense if I show you a sample run of a program that implements the wizard shown…
A: You can put the case statement tp soleve the following query: switch(expression) { case x: //…
Q: Use this exercise to test your code that you wrote in the previous exercise. Problem Class In this…
A: Java Source Code: import java.util.*;class JavaApplication1{String x;JavaApplication1(String op,int…
Q: Write a class that contains the following two methods: /** Convert from Celsius to Fahrenheit */…
A: code : - public class Main{ public static double celsiusToFahreheit(double celsius) {…
Q: How do I solve this problem that deals with counting and subtracting calories in Java without using…
A: Create a new class with name FitnessPlanner1.java, then take the inputs from user.Calculate the VO2,…
Q: Write a program that displays a clock to show the current time, as shown in Figure 9.27a. To obtain…
A: Below is the python code for the same. Please use proper indentation and import the required…
Q: Exercise 2: A. Write static methods: public static double cubeVolume(double h) : h3 public static…
A: public class Geometry { public static double cubeVolume(double h) { return h * h * h;…
Q: This assignment starts with the Account class from Labs 4 and 5. Our new and improved bank has two…
A: package inheritance; import java.util.*; class Bank { Scanner s=new Scanner(System.in);…
Q: Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and…
A: Program Explanation: Import the essential java libraries. Define the method “drivingCost” which…
Q: WAKA, WAKA. Pac-Man was a big hit back in the 80s. One of the things he could do was “teleport” from…
A: A C++ program for the given criteria is as follows, File name: main.cpp” //Declare header files…
Q: Write a class, NumberToMonth, which does the following: a. Ask the user to enter the month of the…
A: Here goes the program in python as no specific language was mention: month=int(input("Enter a month…
Q: "exel.java” Java
A:
Q: Use Java program to add a method printReceipt to the CashRegister class. The method should print the…
A: One of Implementing the above problem : public class CashRegister{ private double purchase;…
Q: 20 Given the above class definition of Color, create a new variable my_color and set it to any shade…
A: OOP or Object-Oriented Programming is a software model that is designed around data or objects…
Q: In this exercise you will write a program to compute the distance between any two geo locations. In…
A: Given that, write a program to compute the distance between any two geo-locations. In this program,…
Q: Write a class, VoteAge, which does the following:a. Ask the user to enter their age (ex. XX)b. Get…
A: The algorithm for the program would be as below:Declare one float variable for accepting user…
Create a "tank" class and use it in a program that accepts height and radius from the user and prints total volume in cubic feet, total volume in gallons, and total weight of the water in pounds. Also print the surface area of the top of the tank, the surface area of the outside of the tank, and the total of these two areas in case you need to paint the tank (in square feet). So, the only inputs the class would need is the height and radius of the tank in feet. (python)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- For this assignment, write a program called Payday.java that will compute and print a person's paycheck. The program will ask the user for the number of hours they worked and their hourly payrate. It will ask the person if they are a union member, in which case 5% of the salary will be withheld for union dues. It will ask the person if the percentage they wish to set aside for their medical savings account. It will then apply a sliding tax scale, defined as follows: Greater than or equal to $2,500 $1,500 up to $2,500 $500 up to $1,500 Less than $500 25% 15% 10% 5% The program must then print a formatted paycheck that shows their gross pay, union deduction, medical deduction, taxes withheld, and net pay. Use a function to determine the tax rate. Use a different function to print the nicely formatted paycheck. Your program should operate like this: ********** ********** Payday V1.0 ***: ******** Enter name: Ray Klump Enter hours worked: 43.25 Enter hourly pay rate: 17.50 Are you a union…It is given twelve balls of identical weight with the exception of one that is either heavier or lighter. Additionally, it is equipped with a dual-pan balance. Utilization of the balance in each instance You may place any number of the 12 balls on the left pan and the same number on the right pan, and then press a button to begin weighing; there are three potential outcomes: the weights are equal, the balls on the left are heavier, or the balls on the left are lighter. Create a technique for determining which ball is the odd one out and whether it is heavier or lighter than the others using the balance in the fewest feasible instances. Solve the issue of weighing 39 balls, one of which is known to be odd.In this exercise, you are going to complete the Rectangle class. You need to complete the class so that you can print and compare two rectangles. Once complete, use the RectangleTester to test the results. In the tester class, you are given 3 rectangles that you should print and compare. Sample results are provided below. Sample output A rectangle with a width of 5 and a height of 4 A rectangle with a width of 5 and a height of 4 A rectangle with a width of 10 and a height of 4 true false =========================================== public class RectangleTester{public static void main(String[] args){Rectangle rect1 = new Rectangle(5, 4);Rectangle rect2 = new Rectangle(5, 4);Rectangle rect3 = new Rectangle(10, 4);// Print all three rectangles// Print one true statement comparing rectangles// Print one false statment comparing rectangles}} =========================================== public class Rectangle{ private int width;private int height;public Rectangle(int width, int height) {}}
- Write a program that takes a decimal value between 1 and 10 and displays its equivalent Roman numeral value. Display an error message ifthe value entered is outside of the acceptable range. Write a two classsolution. The second class should allow the user to input a test value.Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows:1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don’tdisplay the computer’s choice yet.)2. The user enters his or her choice of “rock,” “paper,” or “scissors” at the keyboard.3. The computer’s choice is displayed.4. A winner is selected according to the following rules:• If one player chooses rock and the other player chooses scissors, then rock wins. (Therock smashes the scissors.)• If one player chooses scissors and the other player chooses paper, then scissors wins.(Scissors cuts paper.)• If one player chooses paper and the other player chooses rock, then paper wins. (Paperwraps rock.)• If both players make the same choice, the game must be…Write a program that can suggest an activity based on the temperature. If the temperature is between 20 to 40 degrees Fahrenheit, suggest the user go skiing; if the temperature is between 41 to 60 degrees Fahrenheit, suggest the user go hiking; if the temperature is in the range of 61 to 80, suggest swimming. For all the temperatures out of these ranges (too cold or too hot), then suggest staying inside.
- Implement the design of the Passenger class so that the following output is produced: The assumption is Bus base-fare is 450 taka. A passenger can carry upto 20 kg for free. 50 taka will be added if bag weight is between 21 and 50 kg. 100 taka will be added if bag weight is greater than 50 kg. [You are not allowed to change the code below] # Write your code here print(“Total Passenger:”, Passenger.count) p1 = Passenger(“Jack”) p1.set_bag_weight(90) p2 = Passenger(“Carol”) p2.set_bag_weight(10) p3 = Passenger(“Mike”) p3.set_bag_weight(25) print("=========================") p1.printDetail() print("=========================") p2.printDetail() print("=========================") p3.printDetail() print("=========================") print(“Total Passenger:”, Passenger.count) Output: Total Passenger: 0 ========================= Name: Jack Bus Fare: 550 taka ========================= Name: Carol Bus Fare: 450 taka ========================= Name: Mike Bus Fare: 500 taka =========================…Create a program that will count the number of numeric characters in an input string. The program should be able to ask the user for the input string and should be able to display the number of numeric characters on the screen. For this exercise, you should create your class to handle the different operations. Remember that any input/output operations should be done in the main method while all calculations should be done inside the class. Remember that you need to apply encapsulation in your class. Sample Output: Enter a string: Hello 123 Number of numeric characters: 3Java - Programming Develop a letter-guessing game in this assignment.Requirements:1). When the game begins, generate a random letter between A and Z;2). Display a message "I have a secret letter (A to Z), can you guess what it is?";3). Read the user's answer;4). Compare the user's answer and the random secret letter generated;5). If the user answer is before the random secret letter in the alphabet, display "Incorrect. Trysomething later in the alphabet" and go to Step 2;6). If the user answer is after the random secret letter in the alphabet, display "Incorrect. Trysomething earlier in the alphabet." and go to Step 2;7). If the user answer is the same as the random secret letter, display "Well done. Want to playagain (y/n)?";8). Read the user's answer. If the answer is 'y', go to Step 1. If the answer is 'n', go to Step 9;9). Display "Thanks for playing the game. Goodbye!". The program stops.Run your program several times. Take screenshots. Submit your Java file with the screenshots
- 1. In the game of Monopoly, a pair of dice are rolled to move a player's piece around the board. If a double is rolled (the dice show the same number), the player receives another roll of the dice. If a double is rolled a second time, a third roll of the dice is received. If a double is rolled on the third occasion, the player forfeits their turn (and goes to Jail). Write a program which simulates two players having 50 turns each (a turn however many dice rolls a player has in a row before it's the other player's turn) and determines: a) the total number of spaces moved by each player; and b) how many times a player rolls a double which results in movement of a piece. Use the randi function. For fun, incorporate the rule that a player cannot leave Jail (cannot move) unless they either roll a double or three turns have passed without rolling a double.Write a program that plays a dice game called "21" It is a variation on BlackJack where one player plays against the computer trying to get 21 or as close to 21 without going over. Here are the rules of the game: You will play with dice that have numbers from 1 to 11. To win, the player or the computer has to get to 21, or as close as possible without going over. If the player or computer goes over 21, they instantly lose. If there is a tie, the computer wins. Starting the game: The player is asked to give the computer a name. For now, we'll simply call the computer opponent, "computer." The game starts with rolling four dice. The first two dice are for the player. These two dice are added up and the total outputted to the screen. The other two dice are for the computer. Likewise, their total is outputted to the screen. Player: If a total of 21 has been reached by either the player or the computer, the game instantly stops and the winner is declared. Otherwise,…Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 5.1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet. 5.2. The user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard. Gather this input using JOptionPane.showInputDialog(). 5.3. Display the computer’s choice. 5.4. A winner is selected according to the following rules: If one player chooses rock and the other player chooses scissors, then rock wins. Display something to the effect of: “Rock smashes the scissors.” If one player chooses scissors and the other player chooses paper, then scissors wins. Display something like: “Scissors cuts paper.” If one player chooses paper and the other…