1. If you run the following program, in which order the statements of this program will be executed? Your answer should be a sequence comma separated of line numbers withou any extra spaces, e.g., 1,2,3,4,5,6,7,8 etc. What will this code print out? 1 a = 7 2 b = 8 3 if not (a < 5 or b < 2): 4 if a == 8: print("X") else: 7 print("Y") print("Z") 00
Q: Write a function that converts milliseconds to hours, minutes, and seconds using the following…
A: Steps to convert milliseconds to seconds, minutes, and hours as follows Total seconds = Milli…
Q: If you have the following statements: int x; for(x=2; x<11; x++) { } The last value of x after…
A: Here in this question we have given a code segment and we have asked to find the last value of x…
Q: The Drive-Rite Insurance Company provides automobile insurance policies for drivers. Design a…
A: // Take input from user policy number, customer last name, customer first name, age, premium due…
Q: Q3: The volume of a circular cylinder V=rtr?h, write a program to compute the volume if r=8m and…
A: Objective: This program designs a class to create cylinders for a given height and radius. The…
Q: If you run the following program, in which order the statements of this program will be executed?…
A: Order of execution tells the flow of control in program. Function call can alter the flow of…
Q: Given four values representing counts of quarters, dimes, nickels and pennies, output the total…
A: 1 dollar=4 quarters 1 dollar=10 dimes 1 dollar=20 nickels 1 dollar=100 pennies
Q: 3. B) What is the value of num when the following code snippet runs successfully? int num = 100;…
A: I give the solution to both with output screenshot I also give the code ,output and code screenshot…
Q: Problem #3: Write a program that reads the width, height and a character from the user, then…
A: As there is no programming language is mentioned we are writing this program in c++ Code…
Q: 5. Write a program that reports whether someone is eligible to run for president in the U.S. You…
A: According to the information given:- We have to follow instruction to create eligibility criteria
Q: I am stuck on this problem- this is the question: Meadowdale Dairy Farm sells organic brown eggs to…
A: Note: Below is the required program in java language. Programming Approach: Importing necessary…
Q: Q2:::write a program that computes ,prints and plots A=√X, B-log X; C-In X; D=cx; E-3X; F=X7 Where X…
A: x=1:20 A=sqrt(x) plot(x,A)
Q: QUESTION 14 To assign a value 1 to variable x, you write O 1 = x; O x = 1, O x = 1, O1 = x; O x ==…
A:
Q: In Python please, needs to satisfy multiple inputs: Forms often allow a user to enter an integer.…
A: The code for your problem is written below in python- user_string = input() #taking string from the…
Q: Programming Practice a) Write a program which allows a teacher to determine the min, max, and…
A: Disclaimer: “Since you have asked multiple questions, we will solve the first question for you. If…
Q: Given four values representing counts of quarters, dimes, nickels and pennies, output the total…
A: 1) Below is C++ program that input quarters, dimes, nickels and pennies and output total amount of…
Q: Write a program that implements the algorithm that you designed in Exercise 34 of this chapter…
A: EXPLANATION: - The required double variables billingAmount, paymentAmount, and credit varibles are…
Q: Assignment 3 Write a complete program that accepts two integer numbers num1 and num2, where num1 <…
A: You didn't specify any language for the problem, so i am doing it in C++ programming Langauge.…
Q: The first 11 prime integers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31. positive integer…
A: Note: since the programming language is not specified implementing in C language. code: #include…
Q: ories ( (Age x 0.2757) + (Weight x 0.03295) + (Heart Rate x 1.0781) – 75.4991) x Time / 8.368 te a…
A: CODE : #include<bits/stdc++.h> using namespace std; int main(){ double age; // variable…
Q: Develop a program that begins by reading a few seconds from the user. Then your program should…
A: CODE second=int(input("enter the number of second ")) days=0 hour=0 minutes=0 day=24*60*60…
Q: You are given the code below. It's a game where the user has to guess a sequence of four 1-digit…
A: check further steps for the answer :
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A:
Q: This program should compound interest continuously. It asks the user for the number of times they…
A: Corrections made:Use a single loop instead of 2 loops and remove the list n.Use 2**i to get the year…
Q: Consider records of employees each consists of employee's first name (string), number of hours…
A: I give the code in python along with output and code screenshot
Q: This program should compound interest continuously. It asks the user for the number of times they…
A:
Q: 6.29 LAB: Max and min numbers Write a program whose inputs are three integers, and whose outputs are…
A: Answer: step 1: take three inputs step 2 : define two functions one for finding largest among three…
Q: (4) char chArray[] = {'E', T, 'C', 'D', 'F', 'F'}; (5) int a 5, b-7, c; after the statement…
A: Correct General statement for any array in C is <datatype> <variable_name>[] =…
Q: What is the output of the following code segment? int x = 5; if (x = 2) cout << "This is true!" <<…
A: The given code is : int x=5; if(x=2) cout<< "This is true" << endl; else…
Q: The Drive-Rite Insurance Company provides automobile insurance policies for drivers. Design a…
A: According to the information given:- Drive-Rite Insurance Company gives automobile insurance…
Q: 4. Write a program that computes the employee's payroll of ABC Company. The user is first asked to…
A:
Q: 1. A software company sells a package that retails for $99. Quantity discounts are given according…
A: logic:- take quantity as user input. apply if else to find out discount. at last subtract…
Q: This program should compound interest continuously. It asks the user for the number of times they…
A: Corrections made: Remove the list n and use a single loop instead of two. Use 2**i to get the year…
Q: customer's credit limit is now RM250. UTM M4000. If a customer had a credit limit of RM500, this Due…
A: #include<iostream>using namespace std;int main(){ float c_score, limit, balance; int ac;…
Q: 5. How many the number of errors in the following sub_ program? #include void main( ) { intnum, sum…
A: Here in Error 1) intnum,sum=1; we should use space between int and num correct code int num,sum=1;…
Q: Question 4: sequence Write a function sequence that accepts an number ( int ) and that prints a…
A: START WHILE n > 0 do steps 3 to IF n == 0 PRINT n ELIF n%2 == 0 PRINT n and n=n//2 ELSE PRITN n…
Q: 5. Write a program that reports whether someone is eligible to run for president in the U.S. You…
A: According to the information given:- We have to create a program to satisfy the output.
Q: C++ Programming Exercise: Ther are 50 apartment units. When the rent is $600 per month, all the…
A: #include <iostream>using namespace std;#include<fstream>int main (){double rent,…
Q: You are given the code below. It's a game where the user has to guess a sequence of four 1-digit…
A: Since there are multiple sub parts in this post, as per our policy I'll answer the first three…
Q: A contractor orders, say, 30 cubic yards of premixed concrete toconstruct a patio that is to be,…
A: Code : #include <iostream> #include <cmath> using namespace std; int main() {…
Q: 1. Federal law requires that hourly employees be paid "time-and-a-half" for work in excess of 40…
A: #ask user for hourly wage hourly_wage = float(input('\nEnter hourly wage: ')) #ask user for Number…
Q: Q5: Ask the user to enter five capital letters (A..Z), and check if the letters are in an ascending…
A: According to the provided information: We need to create a program that will take five capital…
Q: A contractor orders, say, 30 cubic yards of premixed concrete to construct a patio that is to be,…
A: Find the required code given as below and sample output :
Q: Q3: Write the algorithm for a program that calculates the cost of the phone bill according to the…
A: The algorithm is shown below. Algorithm PhoneBill(minutes) //Algorithm to find teh total…
Q: What is the value of t1 after execution of these statements if the value of t2 is as follows: char…
A: Lets see the solution.
Q: 1- Write a program in which the user is asked to enter his age based on the year (assuming the…
A: Take input from user. check if the number is positive integer or no. and if the number is positive…
Q: Given the water temperature T in degrees Kelvin, ocean depth D in meters and current speed C in…
A: C code for the given question #include <math.h>#include <stdio.h> int main() { double…
Q: Suppose x, y, and z are int variables and x = 18, y = 5, and z = 4. What is the output of each of…
A: Given, cout << "x = " << x << ", y = " << y << ", z = " << z…
Q: This program should compound interest continuously. It asks the user for the number of times they…
A: Formula for calculating compound interest=P(1+R/N)NTP – Principle amountR – Rate of the interest,…
If you run the following
Step by step
Solved in 2 steps with 1 images
- PROBLEM: Write a program that prompts the user to input three (3) integers: MM, DD, and YYYY. For example, 07 26 1998. The program will print the number of days elapsed from 01 January of that year, i.e. January 1st is always 1 and December 31 is either 365 or 366, depending on if leap year or not. SPECIFICATIONS: - You may only use the codes that we studied under our lectures - All lines of codes should have a comment. - Save your cpp file as TEST CASES: If a user inputs a valid int month, date, and year: Enter MM: 05 Enter DD: 18 Enter YYYY: 1995 Result: 138 days If a user inputs an invalid int month, date, and year: Enter MM: 02 Enter DD: 29 Enter YYYY: 1997 Result: INVALIDC++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.1. Federal law requires that hourly employees be paid “time-and-a-half” for work in excess of 40 hours in a week.For example, if a person’s hourly wage is $12 and he or she works 60 hours in a week, the person’s gross pay shouldbe (40 *12) + (1.5 *12 * (60-40)) = $840.Write a program that requests the floating number of hours a person works in a given week and the person’s hourlywage as input, and then displays the person’s gross pay. Save it as overtimePay.py
- Q3, A lecturer intends to separate his students into 2 groups based on their INDEX Numbers, those with odd numbers in group A and EVEN numbers in B. Use if-else statement to implement this. Q4.Your son intends to randomly mention some numbers to you, write a program using While or do-whileloop that will print all the numbers and the sum of the positive numbers.Use C++ Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: heads tails heads For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to call srand() before each call to rand(). But seeding should only be done once, at the start of the program, after which rand() can be called any number of times. Your program must define and call the following function that returns "heads" or "tails".string HeadsOrTails()Hi, I need help with the following assignment. Implement a program that reads in a year and outputs the approximate value of a Ferrari 250 GTO in that year. Use the following table that describes the estimated value of a GTO at different times since 1962. Year Value 1962-1964 $18,500 1965-1968 $6,000 1969-1971 $12,000 1972-1975 $48,000 1976-1980 $200,000 1981-1985 $650,000 1986-2012 $35,000,000 2013-2014 $52,000,000
- Programming Practice a) Write a program which allows a teacher to determine the min, max, and average grade from grades entered. The teacher will continuously enter grades until the sentinel is specified. For this example, a grade of -1 will be used to denote grading is completed. The min, max, and average grade should then be displayed to the teacher. This program should not accept invalid grades to be used [0, 100]. b) Write a program which outputs prime numbers up to a specified number. For example, if a user entered the number 25, the program would output the prime numbers between 1 and 25. c) Write a program which converts a sum of currency into the highest available denominations in terms of coins. For example, the user inputs the number 4.25. The program would output that it takes 2 Toonies and 1 Quarter. Ensure that the result uses the least amount of coins possible. This can be solved mathematically or using loops.Display the first N magic numbers, where N is a positive number that the user provides as input. Here, a magic number is a number whose sum of its digits eventually leads to 1. For example, 1234 is a magic number because 1 + 2 + 3 + 4 = 10 and 1 + 0 = 1, while 1235 is not (1 + 2 + 3 + 5 = 11 and 1 + 1 = 2). Write a program that prints out the first N magic numbers, seven on each line. You are required to use the following function prototype: bool isMagic(int value); // Returns true if value is a magic number The outline of this function will be as follows: Step 1: Calculate the sum of digits of the value Step 2: Repeat Step 1 until we get a single-digit Step 3: If the resulting sum is equal to 1 then it is a magic number, otherwise not Here is the sample output:analyze the following code .Which of the following is not correct? if (number>0) cout<<number; cout<<number; A. Number ls always printed out twice. B. Number is printed ont once if mumber is zero C. Numbvers printed out once if number is negative. D.Number is printed out twice onty if mumber is positive.
- C++ OOP A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons ofmilk to a local grocery store. The cost of producing one liter of milk is $0.38, and theprofit of each carton of milk is $0.27. Write a program that does the following:• Prompts the user to enter the total amount of milk produced in the morning.• Outputs the number of milk cartons needed to hold milk. (Round your answer tothe nearest integer.)• Outputs the cost of producing milk.• Outputs the profit for producing milk.I'm stuck on this problem, and here's what I'm stumped on: Meadowdale Dairy Farm sells organic brown eggs to consumers in the surrounding area. For a dozen eggs, it charges $3.25, and for individual eggs that are not part of a dozen, it charges 45 cents each egg. Using the following phrasing, write a program that prompts a user to enter the number of eggs in the order and then displays the amount owed along with a detailed explanation of why the amount is due: You placed an order for 27 eggs. There are 2 dozen eggs at $3.25 per dozen and 3 loose eggs at 45 cents each, which adds up to a total of $7.85.C++ Programming Exercise: Ther are 50 apartment units. When the rent is $600 per month, all the units are occupied. However, for each, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.