With the statement, With the statement. int grade-69: if(grade>=70&.&gradec-100) int grade-70; printf("Passed.): if(grade>=70) else if(grade<708&grade>-0 printf("Passed."); printf("Failed.): else printf("Congratulations!"): printf("Invalid Grade!"): What is the output? What is the output? If no break appears in a case, the flow of control will fl to the default case. Congratulations! O Invalid Gradet Passed. Failed. O Tue Passed. O Passed. Congratulations! False O No output. O Passed.Congratulations!
Q: Find the output of the code below : void main( ) { int…
A: PROGRAM CODE: #include<iostream>using namespace std; int main() { int…
Q: Write a program that asks for the names of three runners and the time it took each of them to finish…
A: #include<iostream>using namespace std;int main(){ char r1[20], r2[20], r3[20]; int t1,…
Q: Ask the user to enter the month of the year (number 1 through 12): “Enter the month of the year -…
A: The algorithm for the program would be as below:Declare one int variable for accepting user…
Q: Complete the program shown in the 'Answer' box below by filling in the blank so that the program…
A: As per our guidelines we are supposed to answer only one question . Kindly repost other question as…
Q: THIS IS IN JAVA Given x = 1, y = 2, and z = 3, how is the expression evaluated? In the choices,…
A: Given: <pre><code>(x == 5) || (y == 2) && (z == 5)</code></pre>
Q: A large book box holds 80 lbs, a medium box hold 50 lbs. and a small holds 30 lbs. The average book…
A: A pseudo-code is an informal description of the algorithm, usually in English language. An algorithm…
Q: Study the pseudocode in picture above. Declare the variables testScoreString and classRankString.…
A: start input testScore, classRank if testScore >= 90 if classRank >= 25 then output…
Q: Question 1 Write a program which takes the input from the user of time and distance and calculate…
A: here in this question we have asked to write a program which take input from the user of time and…
Q: 1. What is the output of the following code snippet? int num = 50; if (num > 50); { num = num 5; }…
A: The given C++ code, Initializes the value of "num" as 50. Using "if" condition, the condition…
Q: Movies always come with ratings. A bad movie may have 1.4 stars, and a great movie may have 4.9…
A: EXPLANATION - Math round () - In java language there is special method available for mainly rounds…
Q: can you please write it in java.scanner.util form The Fast Freight Shipping Company charges the…
A: For every 500 miles the charges applies So, you can divide the distance by 500 and get the rate
Q: write a program that enters the test score and display excellent, very good, good, fair. poor, or…
A: I give the code in Python along with output and code screenshot
Q: To find the total marks of a student in an assignment, we need to get the proposal marks, Task 2,…
A: Here I am providing the code and the output for the given problem
Q: Test the following program for different values and identify the error. int main() { double…
A: I have given an answer in step 2.
Q: Exercise 1 Create a method that takes a value and indicate whether it is positive or negative by a…
A: import java.util.Scanner; public class Main{ public static boolean isPositive(int a) {…
Q: What is the output of the following code: int main() { test1(); test1(); return 0; } void…
A: Given: What does the following code produce:
Q: What will be the value of the variable x after the execution of the program? %#3include int main()…
A: Ans : The value of the variable x after execution of the program is : int main(){ int x; x…
Q: In admissions to military high schools, the age of the candidate should be between 13 - 17…
A: Java is a programming language. It contains extensive libraries (package). It can be used to create…
Q: K Chapter 4 Project - new Fall 10-21-20... Project Name: Chpt4_Project Class Name: Chpt4_Project…
A: Java program that accepts names of members on a tug of war team, computes their total weight, and…
Q: Using a conditional expression, write a statement that increments numUsers if updateDirection is 1,…
A: As the whole program is already designed We will use the conditional statement i.e (if else) to…
Q: If you are flying with an economy ticket, there is a possibility that you may get upgraded to…
A: Decision table is a method of describing the logical relationship as a visual representation ( in…
Q: Ask the user for a name and for a list of test scores. Show the number of tests taken and the…
A: Here I have taken input from the user for the name and then created a list to store the marks. Next,…
Q: ou should fill in the blank in the following code with ________. public class Test { public static…
A: Given code: public class Test { public static void main(String[] args) { System.out.print("The…
Q: Using Math.max and/or Math.min, write a class MaxOrMin, and make sure to use Math.max and Math.min…
A: As per our guidelines, we can solve the first three-part of the question.
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: Program code: //include the required header file #include <iostream> #include…
Q: In this assignment, you are going to complete a program that compute gross and net payment based on…
A: code in java : ======================================================== import java.util.*;import…
Q: Jump to level1 Write multiple if statements: If car_year is before 1967, print "Probably has few…
A: NOTE: Since programming, langauge is not mentioned. Therefore answering questions in Python…
Q: How do i solve this problem in python? ( has 3 steps)
A: NOTE:The given information is incomplete (Formula to calculate the minutes to walk or run for a…
Q: Output the classic (albeit slightly modified) drinking song. 99 bottles of Pepsi on the wall, 99…
A: Given: Output the classic (albeit slightly modified) drinking song. 99 bottles of Pepsi on the wall,…
Q: This program inputs the names of 5 students and the (integer) grades they earned in 3 tests. It then…
A: The program will need five methods as follows: Method names() will input the names and return the…
Q: With the statement. int grade- 70: ifgrade +706&gradec-100) printf("Passed ): With the statement.…
A: int grade = 70; if(grade > 70) printf("Passed"); printf("Congratulation"); Answer is First…
Q: (A) Write a Java program that reads student scores, displays the lowest score, and percentage of…
A: The Java program reads n numbers from the user. Then read n scores into the double type array. using…
Q: Please explain what kind of syntax errors or problems the following statements might have. 1 = x;…
A: Given: As per our policy, "Since you have asked multiple questions, we will solve the first question…
Q: Write a program that lets the user enter the loan amount and loan period in number of years and…
A: Program in java for calculation of monthly and total payments for each interest rate. import…
Q: In this lab, you use the flowchart and pseudocode found in the figure below to add code to a…
A: Required Java code is provided below :
Q: 5-3) (Find the highest score) Write a program that prompts the user to enter the number of students…
A:
Q: If the number of items bought is less than 5, then the shipping charges are $7.00 for each item…
A: Correct code Here shipping charges are $7.00 for each item, if the number of items is less than 5.…
Q: 2. What is the output? Show work. When done, run the program. Did you get the same output? class…
A: answer is
Q: There is a problem in the below code. Please add one line to fix it. Scanner input = new…
A: Fix the given Code: Scanner input = new Scanner(System.in); System.out.println("Enter the…
Q: Calculate and return the sum of two decimal numbers - getSum.
A: NOTE:“Since you have asked multiple questions, we will solve the first question for you. If you want…
Q: Suppose that the input is 0 5 6 4 9 8 –1. What is the output of the following code? (2, 3) Submit…
A: while loop in C++ A while loop statement is used to execute a statement repeatedly as long as the…
Q: In an eye-glass shop, a customer can buy either a pair of single prescription glasses (or a pair of…
A: Code: import java.util.*;public class MyClass { public static void main(String args[]) {…
Q: Write a program that asks the user for the number of males and the number of females registered in a…
A: Note : Since it is not mentioned which programming language to use so, i preferred to use Python…
Q: Take a look at the following code: try: if '1' != 1: raise "someError" else: print("someError…
A: Question. Take a look at the following code: try: if '1' != 1: raise "someError" else:…
Q: With the statement, With the statement, int grade=198; int grade=100;…
A: Answers: Invalid Grade! Invalid Grade! True
Q: // This program gets student names continuously until XXX is entered. Then, for each student, quiz…
A: All the return boxes should be connected under one box.
Q: T/F 2) There is no base case in the following method. public int noBaseCase(int x) { if(x > 0)…
A: Given that, There is no base case in the following method. public int noBaseCase(int x){if(x >…
Q: What should be printed on screen? int main() int x = 5; if(x++ == 5) cout<<"Five"<<endl; else if(++x…
A: The output of the given C++ code is: Five Therefore, the correct option is D. Five.
Q: : write a program with visual basic code to give the evaluation for different marks as follows.…
A: below is the code:
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
please answer the 3 questions. i will rate you. thanks
Step by step
Solved in 2 steps with 2 images
- Assignment Write a program that moves a forester unit and a desert corps unit to a given target location and prints the number of hours it took for each unit to reach the target. First, the user will give the starting X and Y positions of the forester unit as well as its base speed (all ints). Then, the starting X and Y positions of the desert corps unit as well as its base speed (all ints). Finally, the target X and Y positions (both ints) and the terrain type (std::string). Speeds are given as distance traveled in one full day (i.e., 24 hours) and is affected by the terrain type using a multiplier over the base speed. Also, after 1 full day, each unit rests for a certain number of hours. Speed multiplier and rest amount of each type of unit depending on the terrain type are as below. Speed Multiplier Rest Duration After 1 day Terrain type Forester Desert Corps Forester Desert Corps Forest 1.3 0.6 4 12 Desert 0.4 1.2 15 6 Hills 0.7 0.8 6 8 Others 1.0 0.8 8 6 After getting all this…Assignment: Dice Rolling Program Objective: Create a Java program that rolls two dice and displays the results. The program should have two Java classes: one for a single die and another for a pair of dice. Assignment Details: User Input: Ask the user to specify the number of sides they want on each die. Ensure that the user's input is within a reasonable range. Dice Rolling: Simulate rolling the dice using Math.random() based on the user's chosen number of sides. Display the sum of the values rolled, e.g., "5 + 3 = 8." Special Combinations: If the dice roll results in combinations of 2, 7, or 12, print special messages: "1 + 1 = 2 snake eyes!" "3 + 4 = 7 craps!" "6 + 6 = 12 box cars!" Main Method: In the main method, create a pair of dice, roll them, and display the results. Allow the user to decide whether to continue rolling the dice or exit the program. Additional Features: You are welcome to add more features or enhancements to the program if desired. In…-int x //x coord of the center -int y // y coord of the center -int radius -static int count // static variable to keep count of number of circles created + Circle() //default constructor that sets origin to (0,0) and radius to 1 +Circle(int x, int y, int radius) // regular constructor +getX(): int +getY(): int +getRadius(): int +setX(int newX: void +setY(int newY): void +setRadius(int newRadius):void +getArea(): double // returns the area using formula pi*r^2 +getCircumference // returns the circumference using the formula 2*pi*r +toString(): String // return the circle as a string in the form (x,y) : radius +getDistance(Circle other): double // * returns the distance between the center of this circle and the other circle +moveTo(int newX,int newY):void // * move the center of the circle to the new coordinates +intersects(Circle other): bool //* returns true if the center of the other circle lies inside this circle else returns false +resize(double scale):void// * multiply the…
- 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.PLEASE CODE IN PYTHON PLEASE USE THE CLASS FUNCTION In python, create a LunchOrder application that prompts the user for the number of hamburgers, salads, french fries, and sodas and then displays the total for the order. The LunchOrder application should includea Food object with a constructor that accepts the price, fat, carbs, and fiber for an item. Food methods should return the price of the item and return the fat, carbohydrates, and fiber. Use the chart below forfood prices and nutrition information:int x //x coord of the center -int y // y coord of the center -int radius -static int count // static variable to keep count of number of circles created + Circle() //default constructor that sets origin to (0,0) and radius to 1 +Circle(int x, int y, int radius) // regular constructor +getX(): int +getY(): int +getRadius(): int +setX(int newX: void +setY(int newY): void +setRadius(int newRadius):void +getArea(): double // returns the area using formula pi*r^2 +getCircumference // returns the circumference using the formula 2*pi*r +toString(): String // return the circle as a string in the form (x,y) : radius +getDistance(Circle other): double // *** returns the distance between the center of this circle and the other circle +moveTo(int newX,int newY):void // *** move the center of the circle to the new coordinates +intersects(Circle other): bool //*** returns true if the center of the other circle lies inside this circle else returns false +resize(double…
- (Physics) Write an assignment statement to calculate the elapsed time, in minutes, it takes to make a trip. The formula for computing elapsed time is elapsed time = total distance / average speed. Assume the distance is in miles and the average speed is in miles per hour (mph).Note: The code is written you can just tell the explanation what is happening in the code Explain in English.Just explain the whole code. #include <iostream>using namespace std;class PrimeNumberGenerator{private:int counter;public://ConstructorPrimeNumberGenerator() : counter(0){}//Function to reset countervoid reset(){counter = 0;}int getCounter(){return counter;}//Function to return next prime number after currentPrimeint getNextPrime(){if(counter == 0){counter = 2;}else{for(int i = counter + 1; ; i++){if(isPrime(i)){counter = i;break;}}}return counter;} //Function to check if a number is prime or notbool isPrime(int num){for(int i = 2; i <= num/2; i++){if(num % i == 0)return false;}return true;}}; int main() {int option;PrimeNumberGenerator gen;cout << "Enter 1 if you want to reset\n";cout << "Enter 2 if you want to get next prime number\n";cout << "Enter -1 to quit: ";cin >> option;while(option != -1){if(option == 1){gen.reset();cout <<…Assignment Description This program will simulate part of the game of Yahtzee! This is a dice game that involves rolling five dice and scoring points based on what show up on those five dice. The players would record their scores on a score card, and then total them up, and the player with the larger total wins the game. A Yahtzee score card has two portions: The upper portion has spaces for six scores, obtained by adding up all of the 1's, 2's, 3's, etc. The lower portion has special scores for various combinations: Three of a kind -- at least 3 dice are the same number;the score is the sum of all five dice Four of a kind -- at least 4 dice are the same number;the score is the sum of all five dice Small straight -- four consecutive numbers are represented, e.g. 2345;the score is 25 points Large straight -- five consecutive numbers are represented, e.g. 23456;the score is 30 points Full House -- three of one kind, two of another; the score is 30 points Yahtzee! -- five of a kind; the…
- Write a program that: Defines an enum named Classification. The enum Classification will have 2 data values: undergraduate, graduate. Defines an enum named Status. The enum Stutus will have 2 data values: parttime, fulltime. Defines an enum named Residency. The enum Residency will have 2 data values: resident, international. Defines a student name variable. Creates a Classification, Status, and Residency, credit hour, cost per credit hour, and tuition variable. Reads the value of the Classification, Status, and Residency, student name and credit hour variable from the user. If the student is a fulltime undergraduate resident student, tuition is credit hour times 345.00 If the student is a fulltime undergraduate international student, tuition is credit hour times 685.00 If the student is a fulltime graduate resident student, tuition is credit hour times 545.00 If the student is a fulltime graduate international student , tuition is credit hour times 885.00 If the student is a parttime…Write a program that: Defines an enum named Classification. The enum Classification will have 2 data values: undergraduate, graduate. Defines an enum named Status. The enum Stutus will have 2 data values: parttime, fulltime. Defines an enum named Residency. The enum Residency will have 2 data values: resident, international. Defines a student name variable. Creates a Classification, Status, and Residency, credit hour, cost per credit hour, and tuition variable. Reads the value of the Classification, Status, and Residency, student name and credit hour variable from the user. If the student is a fulltime undergraduate resident student, tuition is credit hour times 345.00 If the student is a fulltime undergraduate international student, tuition is credit hour times 685.00 If the student is a fulltime graduate resident student, tuition is credit hour times 545.00 If the student is a fulltime graduate international student , tuition is credit hour times 885.00 If the student is a parttime…Rolling Dice Simulator [Java Assignment]Objective: Create a Java program that rolls two dice and displays the results. The program should have two Java classes: one for a single die and another for a pair of dice. Assignment Details: User Input: Ask the user to specify the number of sides they want on each die. Ensure that the user's input is within a reasonable range. Dice Rolling: Simulate rolling the dice using Math.random() based on the user's chosen number of sides. Display the sum of the values rolled, e.g., "5 + 3 = 8." Special Combinations: If the dice roll results in combinations of 2, 7, or 12, print special messages: "1 + 1 = 2 snake eyes!" "3 + 4 = 7 craps!" "6 + 6 = 12 box cars!" Main Method: In the main method, create a pair of dice, roll them, and display the results. Allow the user to decide whether to continue rolling the dice or exit the program. Additional Features: You are welcome to add more features or enhancements to the program if desired.…