Health application: BMI) Revise Listing 3.4, ComputeAndInterpretBMI.java, to let the user enter weight, feet, and inches. For example, if a person is 5 feet and 10 inches, you will enter 5 for feet and 10 for inches. Here is a sample run: Enter weight in pounds: 140 Enter feet: 5 Enter inches: 10 BMI is 20.087702275404553
Q: Java Program 1. JA’s GYM Equipment rents gym equipment such as dumbbell, kettlebell, Treadmill,…
A: logic:- read number of minutes from user. Get number of hours=minutes/60 calculate remaining…
Q: If the new operator cannot allocate the amount of memory requested, it throws_____________
A: Given : If the new operator cannot allocate the amount of memory requested, it throws_____________
Q: thon Geography Grades 2 Make a copy of your program for the problem Geography Grades 1 and change…
A: It is defined as an interpreted, object-oriented, high-level programming language with dynamic…
Q: 7.17 (Even or Odd) Write expression-bodied method IsEven that uses the remainder operator (8 ) to…
A: PROGRAM EXPLANATION: - The Numbers class comprises of isEven function having bool return type. The…
Q: Quiz 3.2: Question 3 Unlimited tries NOTE: in mathematics, division by zero is undefined. So, in…
A: Given data is shown below:
Q: 8. You live in a village. The village can be represented as a line that contains n grids. Each grid…
A: C code with output provided below:
Q: *3.9 (Financial application: payrollI) Write a program that reads the following infor- mation and…
A: use input function to take user’s input and store in variable . once data is stored in variable use…
Q: 3. Factorials/MathUtils File Factorials.java contains a program that calls the factorial method of…
A: ote: Could you plz go through this code and let me know if u need any changes in this.Thank…
Q: **4.24 (Game: pick a card) Write a program that simulates picking a card from a deck of 52 cards.…
A: public class Pickupcard { public static void main(String[] args) { int card = (int) (Math.random()…
Q: Part 3– Change In this part, you are asked to write a program that makes change for amounts less…
A: Introduction:- Below is the complete solution with Python Program and Output Images.
Q: Population Count Description: The population count is the number of 1s (ones) in the binary…
A: The answer is given below.
Q: Population Count Description: The population count is the number of 1s (ones) in the binary…
A: Write a Java program to input the population(a non-negative integer) from the user and count the…
Q: T/F 3) The parameter (String[ ] variable) is used in a Java key method such that a user may run the…
A: Below is the correct answer:
Q: Used Java 4.23 (Financial application: payroll) Write a program that reads the following information…
A: We need to develop a program as per the given logic. Programming Language : Java As required, the…
Q: Write a program that plays a number-guessing game to guess a secret number randomly generated within…
A: // Java program for the above approach import java.util.Scanner; public class GuessingGame { //…
Q: q1) provide commneted code for each line of code
A: I have given the whole code with proper comments so that you can understand it well. Hope it will…
Q: Dry run the following code. You have to complete the iterations and fill the table: #include…
A: Given question has asked to dry run the following code and to complete the iterations and fill the…
Q: Please code in python Forbidden concepts: recursion, custom classes A grocery store needs to…
A: apple_type = int(input("Enter the number of different type of apples: "))stock = {}for i in…
Q: Guess number game. Write a program in Java to: a. Generate a random integer between 1 and 100…
A: In Java, random() method is used to generate random numbers. Syntax to Generate Random Number…
Q: GetContestantNumber - This method gets and returns a valid number of contestants and is called twice…
A: Below is the implemented code for the given problem statement
Q: 8. You live in a village. The village can be represented as a line that contains n grids. Each grid…
A: Each person can reach 1 grid. People can only access their homes. Note that HB.BH also works. Each…
Q: Transcribed Image Text JAVA Programming Problem: In the game of "Assassin's Creed", you control a…
A: As per the given problem statement we are required to develop a JAVA program to output the number of…
Q: Create an iterator that returns numbers, starting with 1, and each sequence will increase by one…
A: Solution in C++- #include <iostream>using namespace std;void interater(){ for (int i =1;…
Q: 12:09 O & R all 86% Asgn5 Part 2 - recursion For this part, you have 2 small programs to write…
A: Solution :: Lets see the above question in Java programming language :: Code :: import…
Q: (Same-number subsequence) JAVA Class Name: Exercise22_05 Write an O(n) program that prompts the…
A: Java program: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: #include using namespace std; class Player { private: int id; static int next_id; public:…
A: Coded using C++.
Q: Java Programming Write an application in which the user can enter a date using digits and slashes…
A: Implement isValidDate method that accepts the month, day, and year as three parameters. It verifies…
Q: Write a program that works out the amount a person has to pay for parking in a car park in a tourist…
A: The program is to calculate parking charges. If they say they are disabled, they are told it is…
Q: Problem (class ConsecutiveNumbers) Write a Java program that checks if a series of 10 numbers…
A: Here have to determine about code for number in sequence or not.
Q: #include using namespace std; class Player { private: int id; static int next_id; public: int…
A: The output of the given program is:- 1 2 3
Q: cerat javaFX 9-Rock, Paper, Scissors Game Create a JavaFX application that lets the user play the…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: Population Count Description: The population count is the number of 1s (ones) in the binary…
A: A binary number is defined as a number that is expressed in the binary system or base 2 numeral…
Q: c++ Implement a feature that recursively calculates how many drinks you can buy. You get three…
A: #include <iostream>using namespace std;// function solveint solve(int num,int price,int…
Q: mplement a class CreditCard. A CreditCard is defined by a 16-digit number and an expiration date. A…
A: Lets see the solution.
Q: Java Class: Fundraiser You are a fundraising distributor who needs to to pre-sell a limited number…
A: A java program is defined as a class with a main function defined inside the class. The main program…
Q: Look at the following code. int x = 7; int *ptr = &x;What will be displayed if you send the…
A: Given: Look at the following code. int x = 7; int *ptr = &x;What will be displayed if you send…
Q: int i 0; = while (i < 10) { cout << i << endl; i=i+2; }
A: I HAVE PROVIDED SOLUTION IN STEP2
Q: Bonus Quesion 2: What the following code does? int * DataGroup = new int [100]; if (!DataGroup){ ...…
A: C++ programming language is an object-oriented programming language, that's used to build…
Q: Used Java 4.23 (Financial application: payroll) Write a program that reads the following information…
A: The program would have the following 4 sections:The declaration and initialization of the variables…
Q: void fun(int i) { do { if (i % 2 != 0) cout = 1); 1. cout << endl; } int main() { int i= 1;
A: Here C++ Code is given, output for the code is given below.
Q: 3-The following pattern of numbers is called Pascal's triangle. 1 1 1 1 2 1 1 3 3 1 4 6 4 1 The…
A: Answer If you adjust the tabulation slightly, you can see the solution more easily: The function…
Q: 5.21 (Pythagorean Triples) A right triangle can have sides whose lengths are all integers. The set…
A: Code: import java.io.*; import java.util.*; // Class for Pythagorean number table generation public…
Q: include using namespace std; class Player { private: int id; static int next_id; public: int…
A: Here have to determine about c++ code and output.
Q: Three numbers a. Write a program that reads three numbers and prints “all the same” if they are all…
A: Note:- Since programming language is not mentioned we are providing solution in c++ . please repost…
Q: Question Language: JAVA Keep Guessing Write a program that plays a number-guessing game to guess a…
A: Import the required java libraries. In main an object of the Random class has been created as r. In…
Q: Art.java must take one (1) integer command-line argument n that controls the depth of recursion.…
A: import java.awt.*;import javax.swing.*; public class DrawLines extends JPanel { static int i = 0;…
Q: the file Ackermann.cpp. Inside the file the recursive Ackermann function is implemented (described…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: Program4 - (from ch7) - Computer-Assisted Instruction (Project Name: AITeacher) - The use of…
A: Actually, given information: The use of computers in education is referred to as computer-assisted…
Q: Welcome Assignment ### welcome_assignment_answers ### Input - All eight questions given in the…
A: Networking allows communication among millions of users worldwide. Besides, there exist several…
Health application: BMI) Revise Listing 3.4, ComputeAndInterpretBMI.java, to let the user enter weight, feet, and inches. For example, if a person is 5 feet and 10 inches, you will enter 5 for feet and 10 for inches. Here is a sample run: Enter weight in pounds: 140 Enter feet: 5 Enter inches: 10 BMI is 20.087702275404553
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Used Java 4.23 (Financial application: payroll) Write a program that reads the following information and prints a payroll statement: Employee’s name (e.g., Smith)Number of hours worked in a week (e.g., 10)Hourly pay rate (e.g., 9.75)Federal tax withholding rate (e.g., 20%)State tax withholding rate (e.g., 9%) A sample run is shown below:Enter employee's name: SmithEnter number of hours worked in a week: 10Enter hourly pay rate: 9.75Enter federal tax withholding rate: 0.20Enter state tax withholding rate: 0.09Employee Name: SmithHours Worked: 10.0Pay Rate: $9.75Gross Pay: $97.5Deductions:Federal Withholding (20.0%): $19.5State Withholding (9.0%): $8.77Total Deduction: $28.27Net Pay: $69.22 Requirement: Requirements: Input and output must match the format provided in the exercise sample runs Currency must be displayed properly: You must have a dollar sign ($) and 2 places after the decimal (dollars and cents) You must use printf rather than the goofy trick from earlier chapters…Bulgarian solitaire def bulgarian_solitaire(piles, k): You are given a row of piles of pebbles, all identical, and a positive integer k so that the total number of pebbles in these piles equals k*(k+1)//2, the arithmetic sum formula that equals the sum of positive integers from 1 to k. Almost as if intended as a metaphor for the bleak daily life behind the Iron Curtain, all pebbles are identical and you don't have any choice in your moves. Each move picks up one pebble from each pile (even if doing so makes that pile vanish), and creates a new pile from the resulting handful. For example, starting with[7, 4, 2, 1, 1], the first move turns this into [6, 3, 1, 5]. The next move turns that into [5, 2, 4, 4], which then turns into the five-pile configuration [4, 1, 3, 3, 4], and so on. This function should count how many moves are needed to convert the given initial piles into the goal state where each number from 1 to k appears as the size of exactly one pile, and return that count. These…(Evaluate expression) Modify Listing 20.12, EvaluateExpression.java, to addoperators ^ for exponent and % for remainder. For example, 3 ^ 2 is 9 and 3% 2 is 1. The ^ operator has the highest precedence and the % operator has thesame precedence as the * and / operators. Your program should prompt theuser to enter an expression. Here is a sample run of the program: Enter an expression: (5 * 2 ^ 3 + 2 * 3 % 2) * 4(5 * 2 ^ 3 + 2 * 3 % 2) * 4 = 160 Here is the Listing 20.12 to modify: import java.util.Stack; public class EvaluateExpression { public static void main(String[] args) { // Check number of arguments passed if (args.length != 1) { System.out.println( "Usage: java EvaluateExpression \"expression\""); System.exit(1); } try { System.out.println(evaluateExpression(args[0])); } catch (Exception ex) { System.out.println("Wrong expression: " + args[0]); } } /** Evaluate an expression */ public static int evaluateExpression(String expression) { // Create operandStack to store operands…
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A, B, C, D, E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. In Java, composition is said to use __ relationship. A. is-aB. part-ofC. has-aD. both is-a and part-ofE. both has-a and part-of Part 2 - 10. Given the following code, which statement is true? class Water() { ... }class Juice() extends Water { ... }class Apple() { ... }class ApplePie() { Apple a1 = new Apple(); }class AppleJuice() { Apple a1 = new Apple(); Water w1 = newWater(); } A. Juice is a superclass and Water is a subclass.B. ApplePie is a superclass of Apple.C. ApplePie is a composite class that contains an instance of Apple class.D. AppleJuice is a superclass that contains an instance of Apple class and an instance of Water.E. Water is a composite class that contains an instance of Juice.HangmanAA.java For this program, you will create the game Hangman. (If you are unsure of how to play Hangman, Google it.) The game will start by asking player 1 for a word or phrase (can be multiple words). Then player 1 will be asked how many missed guesses are allowed by player 2. Once this information is received, player 2 will take over. (Have the program print many blank lines of space so that player 2 can’t see what player 1 entered.) The instructions should be displayed for player 2 as well as the number of misses they’re allowed to make before they lose the game. The screen should also output dashes or underscores to represent each letter of player 1’s secret word/phrase. Player 2 should guess one letter at a time. Case should not matter. Typing x or X should give the same result. If that letter is present in the mystery phrase, then it should be displayed. (It will replace the dash/underscore in that spot. Spaces, punctuation, and all other non-alphabetic characters should…Parking Charges Program in java Write a program that works out the amount a person has to pay for parking in a car park in a tourist town. If they say they are disabled, they are told it is free. Otherwise they enter the number of hours as a whole number (1-8) that they wish to park as well as whether they have an “I live locally” badge or are an old age pensioner both of which leads to a discount. The program tells them the cost to park. The calculation is done in this program as follows. If they are disabled it is free. Otherwise ... Take number of hours they wish to park and give a basic charge: • • • • 1 hour: 3.00 pounds 2-4 hours: 4.00 pounds 5-6 hours: 4.50 pounds 7-8 hours: 5.50 pounds Next modify the resulting charge based on whether they are local or not: • If local: subtract 1 pound If OAP: subtract 2 poundsYour program MUST include methods including ones that - asks for the hours and returns the basic charge. - asks whether they live locally /…
- Question 2: Ben number (In Java)Ben had difficulty coming out with an assignment question, then he created an odd number called Ben number, which is the sum of a Ben series. Let x be the starting number and y be the bout number, in the Ben series, the x should double the value when it is an even number. In contrast, the number should be subtracted by 1 when x is an odd number. Both x and y should be greater than 0.Example of a Ben series, Assume the x = 3, and y = 5, then the series should be [3, 2, 4, 8,16]. Then the Ben number should be 33 because of 3+2+4+18+16.Thus, given the method benNumber(m,n), for all m, n > 0benNumber(2,5) should return 62 because 2+4+8+16+32 = 62benNumber(3,8) should return 257 because 3+2+4+8+16+32+64+128 = 257benNumber(1,1) should return 1Note that you can only use recursion to solve Q1 and Q2, and you cannot use any loop. You are free to add helper methods, but you are not allowed to change the method header.(PYTHON) A nutritionist who works for a fitness club helps members by evaluating their diets. As part of her evaluation, she asks members for the number of fat grams and carbohydrate grams that they consumed in a day. Then, she calculates the number of calories that result from the fat, using the following formula: calories from fat = fat grams x 3.9 Next, she calculates the number of calories that result from the carbohydrates, using the following formula: calories from carbs = carb grams x 4 The nutritionist asks you to write a program on *PYTHON* that will make these calculations.5: CheckLetter.cpp) Write a program that adds a checkletter to an eight-digit number. The check letter should becomputed as follows: Break the number up into 4 two-digitnumbers. Add the four numbers together. Find theremainder after division by 26. The check letter is the letterin the alphabet that corresponds to the number justcomputed. (A=0, B=1, C=2, etc.) Print the original numberfollowed by the check letter. Use at least one ffunction thatreturns a value when you write this program.
- Order check Write a program OrderCheck.java that takes four int command-line arguments w, x, y, and z. Define a boolean variable whose value is true if the four values are either in strictly ascending order (w < x < y < z) or strictly descending order (w > x > y > z), and false otherwise. Then, display the boolean variable value.Change the calendar printing program so it starts the week on a Sunday. Also make it print a newline at the end (but only one). This program had to utilize the code from page 61 and make the necessary changes for printing it. The code itself would display the calendar and you would not have to use the println function as you would have to do that for every single month and year. The program would grab the month a year you selected and display it. import java.time.DayOfWeek;import java.time.LocalDate; public class Calendar { public static void main(String[] args) {// TODO Auto-generated method stubint month = 0;int year = 0;LocalDate date= LocalDate.of(year, month, 1);while (date.getMonthValue() == month) {System.out.print(date.getDayOfMonth());date = date.plusDays(1);}DayOfWeek weekday = date.getDayOfWeek();int value = weekday.getValue();for (int i = 1; i<value; i++);System.out.print(" ");int value1 = date.getDayOfWeek().getValue(); import calendar;y = int(input("Input the years…Part 2 - OddOrEven ClassWrite a program that prompts the user to enter an integer. The program should display “The input is odd" to the screen if the input is odd and displays “The input is even" to the screen if the input is even. Hint: Consider using the mod (%) operator