This program prompts the user to enter the current month, using 1 for January, 2 for February... or q or Q to stop; do only the 1st 3 months Each month must have its own object and method that query the user for the 1st 10 days of rainfall for each month; assume rainfall is not negative or alphabetic characters, only positive Compute the avg rainfall for each month and display it Each object must update the same, one, variable with avg for all 3 months main() print the result
Q: Given the declaration Circle x = new Circle(), which of the following statement is most accurate. a.…
A: EXPLANATION: In Java, an int is a primitive data type, but an Integer is a Wrapper class. The data…
Q: I have no idea how to start this problem. This is the question - Write a program that declares two…
A: PROGRAM: //Importing time header file to access the functions import java.time.*; //Defining the…
Q: What values are returned by each of the following?a. Math.round(2.3)b. Math.round(2.7)c.…
A: Math.round() method In Java, the Math.round() function is used to round numbers to the nearest…
Q: exit the program whenever I entered letter E but it is not working. It keeps printing the…
A: While loop condition: The "while" loop is a java language looping statement that repeats a block of…
Q: Celsius Temperature Table - prog 6 pg 291 * formula for fahrenheit to celsius is c = 5/9(f-32) *…
A: I give the code in java along with output and code screenshot
Q: use only C# programming Write a method call CubeIt(int x, ref int cube) that takes two arguments…
A: As per the guidelines of Bartleby, we experts are supposed to answer only one question in case of…
Q: sing C#, write an application that computes the area of a circle, rectangle, and cylinder. Display a…
A: According to the Question below the Solution: Output:
Q: Instructions Previously, you wrote a program named Admission for a college admissions office in…
A: Below I have provided a Java program for the given question. Also, I have attached a screenshot of…
Q: Write an application that prompts a user for two integers and displays every integer between them.…
A: FIND INTEGERS INBETWEEN : 1. First create a class here it is called IntegerInbetween . 2. Create…
Q: 3. A method named getResult that takes three characters: the first two must contain numbers (1-9),…
A: public class Main{ //method to check a character is number or not public static boolean…
Q: Write a program that analyzes an object falling for 10 seconds. It should contain main and two…
A: 1 meter = 3.28 feet
Q: 9. Follow the comments to insert the missing parts of the code below: // Create a checkAge () method…
A: static void ..........(....... ..........){ ...........(..... ......... ........ ){…
Q: public static int cube(int num) { return num num num; What is the correct statement to pass value 8…
A: Function calls using the call by value method involve copying of the values of the actual parameters…
Q: Write a method for solving a quadratic equationusing the following header:public static int…
A: EXPLANATION: - Quadratic Equation is given as: - ax^2 + bx +c = 0 The input for a,b, and c is…
Q: Retail price calculator Write a program that asks the user to enter an item’s wholesale cost and its…
A: Step 1 : Start Step 2 : Define a method calculateRetail() to calculate and return the retail price…
Q: Modify your working program from Assignment #19 so that when the user enters data into the Selling…
A: Description : Entry widgets are the basic widgets of Tkinter used to get input, for example text…
Q: java Temperature Conversions Follow the following methods to get answer Method celsius returns the…
A: Step 1: Display Menu 1. Fahrenheit to Celsius, 2. Celsius to Fahrenheit, 3. Exit Step 2: Accept…
Q: Modify your working program from Assignment #19 so that when the user enters data into the Selling…
A: Note: Follow proper indentation to get output. Basic Methods used in Program: mainloop(): mainloop…
Q: Given two integers as user inputs that represent the number of drinks to buy and the number of…
A: Solution: Given, class VendingMachine: def __init__(self): self.bottles = 20…
Q: Learn C# beginner programming - Simple code - Im stuck on the Date format. Im creating a int for…
A: Literal is a numeral constant or string constant value set to the integer variable and string…
Q: Given the following code, what is displayed? Integer numFriends = 256; Integer numCookies = 256;…
A: Output of the code:
Q: Write an application that prompts a user for two integers and displays every integer between them.…
A: Hey, you haven't mentioned the programming language. So, we are using java to solve this question.
Q: Write an application that prompts the user for two integers and then prompts the user to enter an…
A: Here is the program screenshot in java:
Q: Write an application that displays the result of dividing two numbers and displays any remainder.…
A: Introduction Write an application that displays the result of dividing two numbers and displays…
Q: Given two integers as user inputs that represent the number of drinks to buy and the number of…
A: Start Input purchase Input restore Call the function and print the updated inventory Stop
Q: This Java program,prompts the user to enter either an 'F' for Fahrenheit or 'C' for Celsius (either…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Previously, you wrote a program named Admission for a college admissions office in which the user…
A: using System; namespace _155119 { class Program { static void Main(string [] args) {…
Q: public class IncreasedProduction { publicstaticvoidmain (String[] args) { // Write your code here }…
A: Define package java.text.DecimalFormat for formatting output in java Define class…
Q: Java Your program will read in a credit card number and expiration date from the user and validate…
A: The program makes use of Scanner class defined inside java.util package. The syntax for it is:…
Q: 6.18 Lab: Flip a Coin Define a method named coinFlip that takes a Random object and returns "Heads"…
A: As Language is not defined doing it in Java Language:
Q: T/F 2) The following method lacks a base case. public int noBaseCase(int x) { if(x > 0) return…
A: Given that, The following method lacks a base case.public int noBaseCase(int x){if(x > 0)return…
Q: For this program you need to use Eclipse. Carefully read the instructions and write a program that…
A: The program has the following algorithm: Step 1: Create object for “Scanner” class to read the user…
Q: C++ write an application that enable users to enter student id and three exam scores. Provide a…
A: The program has two function one for calculating average and snother for printing values. The main…
Q: Answer TRUE if the expression will return non-zero and FALSE if not. Evaluate using the following…
A: Answer TRUE if the expression will return non-zero and FALSE if not. Evaluate using the following…
Q: Which statement illustrates the invocation of a static method O doubel s = exp.Math(200); %3D double…
A: static methods are the methods that are declared at class level which means that they are common for…
Q: using java (Use the Date class) Write a program that creates a Date object, sets its elapsed…
A: Complete Answer in Java Programming language is below:
Q: You can use the following method header to override the equals method in Object class: public…
A: Definition: Method: It is a particular block of the code that is used for running only when that is…
Q: Your program must define and call the following method. The method should return true if the input…
A: if multiple of 4 if multiple of 100 if multiple of 400…
Q: Car's state is set to hold the speed of travel and distance to travel at that speed Precondition:…
A: Code : Car.java package Vehicle; import java.text.DecimalFormat;import java.util.Random; public…
Q: A magic date is one when written in the following format, the month times the date equals the year…
A: def magicDate(dd,mm,yy): #Checking for validity of the data if dd < 1 or dd > 31:…
Q: Write a program that asks the user to enter a distance in meters. The program will then pre-sent the…
A: import java.util.*;import java.lang.*;public class Main { static double showKilometers(double…
Q: Green Carpet Company wants a program to compute carpet costs. The program prompts the user for two…
A: Green Carpet Company wants a program to compute carpet costs. The program prompts the user for…
Q: This program will ask a user to enter their favorite color. Your program will tell the user what…
A: Program Approach: Import necessary header files create a class the main method create a scanner…
Q: 1. Complete the following methods: a) public static double calculateArea (double radius) { // return…
A: a) public static double calculateArea (double radius){ double area; area= 3.14*radius*radius; return…
Q: Which of the following statements is the precise meaning for the statement n = 3?(a) n is a variable…
A: Which of the following statements is the precise meaning for the statement n = 3? (a) n is a…
Q: This JAVA program prompts the user to enter the current month, using 1 for January, 2 for…
A: 1. Create a class Rainfall. Declare two integer variables to hold the month and average as shown.…
Q: public static int cube(int num) { return num } num num; What is the correct statement to pass value…
A: Option 1) cube(8) = int result; This option is wrong. left side should be result value, right side…
Q: What will the following code display?try:x = float('abc123')print(x)except IOError:print('This code…
A: Exceptions An exception occurs when some wrong input is being entered by the end-user or read from…
Q: Green Carpet Company wants a program to compute carpet costs. The program prompts the user for two…
A: Green Carpet Company wants a program to compute carpet costs. The program prompts the user for…
Simple JAVA
Step by step
Solved in 2 steps with 1 images
- (C#)Which statement generates random floating-point numbers in the range of 0.0 to 1.0?Please note that this will not compile, intentionally, I'm looking for you to identify the method in the Random class that will answer the question above. Question 13 options: Random rn = new Random(); float d = rn.Next(1.0); Random rn = new Random(); float d = rn.Next(0.0, 1.0); Random rn = new Random(); float d = rn.NextDouble(1.0); Random rn = new Random(); float d = rn.NextDouble ();Write a method for solving a quadratic equationusing the following header:public static int solveQuadratic(double[] eqn, double[] roots)The coefficients of a quadratic equation ax2 + bx + c = 0 are passed to the arrayeqn and the real roots are stored in roots. The method returns the number of realroots. See Programming Exercise 3.1 on how to solve a quadratic equation.Write a program that prompts the user to enter values for a, b, and c and displaysthe number of real roots and all real roots.Create a program that reads integers from the user until the enter key is pressed. Onceall of the integers have been read your program should display all of the negativenumbers, followed by all of the zeros, followed by all of the positive numbers. Withineach group the numbers should be displayed in the same order that they were enteredby the user. For example, if the user enters the values 3, -4, 1, 0, -1, 0, and -2 thenyour program should output the values -4, -1, -2, 0, 0, 3, and 1. Your programshould display each value on its own line.
- Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.Please written by computer source Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity and $11.5 as total. Sample Run Enter the subtotal and a gratuity rate: 10 15 The gratuity is $1.5 and total is $11.5 Class Name: Exercise02_05// P41.cpp - A simple elevator for 4 floors and a basement with a // close door button and 5 keys for floors #include<iostream> #include<cmath> using namespace std; void close_door(); int change_floor(int choice, int floor); int main( ) { int key; int floor = 0; cout << "Press a Key \n"; cin >> key; if(key == 0) { close_door(); if( floor != 0){ // otherwise nothing happens cout << "I am moving to the Basement \n"; floor = change_floor(0, floor); } } else if(key == 1) { close_door(); if( floor != 1){ // otherwise nothing happens cout << "I am moving to the the First Floor \n"; floor = change_floor(1, floor); } } else if(key == 2) { close_door(); if( floor != 2){ // otherwise nothing happens cout << "I am moving to the the Second Floor \n"; floor = change_floor(2, floor); } } else if(key == 3) { close_door(); if( floor != 3){ // otherwise nothing happens cout << "I am moving to the the Third Floor \n"; floor = change_floor(3, floor); } }…
- __ComputeSumOfDigits that prompts the user to type an integer and computes the sum of the digits of that integer.Body Mass Index (BMI) is a measure ofhealth on weight. It can be calculated by taking your weight in kilograms anddividing, by the square of your height in meters. Write a program that prompts theuser to enter a weight in pounds and height in inches and displays the BMI. Noteone pound is 0.45359237 kilograms and one inch is 0.0254 meters. Here is asample run: Enter weight in pounds: 95.5 ↵EnterEnter height in inches: 50 ↵EnterBMI is 26.8573Write an application that prompts a user for two integers and displays every integer between them. Display There are no integers between X and Y if there are no integers between the entered values. Make sure the program works regardless of which entered value is larger.
- **THE CODE SHOULD BE IN JAVA** Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average. An example of the program is shown below: Enter a score >> 6 Enter another score or 99 to quit >> 7 Enter another score or 99 to quit >> 9 Enter another score or 99 to quit >> 7 Enter another score or 99 to quit >> 99 4 valid scores were entered Highest was 9 Lowest was 6 Average was 7.25● Create a simple calculator application that asks a user to enter twonumbers and the operation (e.g. +, -, x, etc.) that they’d like to perform onthe numbers. Display the answer to the equation. Every equation enteredby the user should be written to a text file. Use defensive programming towrite this program in a manner that is robust and handles unexpectedevents and user inputs. Now extend your program to give the user the option to either enter twonumbers and an operator, like before, or to read all of the equations froma new txt file (the user should add the name of the txt file as an input) andprint out all of the equations together with the results. Use defensiveprogramming to ensure that the program does not crash if the file doesnot exist and that the user is prompted again to enter the name of the file.C++ write an application that enable users to enter student id and three exam scores. Provide a method to compute and return overall exam average. Provide another method that prints all score and average value formatted with no digits to the right of the decimal. Use single method to enter all data