2 Edit the program provided so that 3 theSum = 0.0 it receives a series of numbers 4 data = input("Enter a number: ") from the user and allows the user 5 while data != "": to press the enter key to indicate number = float(data) that he or she is finished theSum += number data = input ("Enter the next number: ") 9 print("The sum is", theSum) 8 providing inputs. After the user presses the enter key, the program should print: 1. The sum of the numbers 2. The average of the numbers
Q: PYTHON!!!!! Edit the program provided so that it receives a series of numbers from the user and…
A: theSum = 0.0c = 0 # To count the number of input numbers data = input("Enter a number and for exit…
Q: Output each floating-point value with two digits after the decimal point, which can be achieved as…
A: code : - name1 = input('Enter food item name: \n')price1 = float(input('Enter item price: \n'))q1 =…
Q: Q2\Rewrite the following program without any errors to get the following output. #include using…
A: #include<iostream>using namespace std;int main(){ float x; float y; cout<<"enter two…
Q: 1 + 2.0F + 3.0M Select the correct data type that the above expression evaluates to in C# O int…
A: In C# programming ,it is must to specify the suffix to use for the data type value to set whether it…
Q: Write a program to find all even numbers between 100 and 400. The number obtained should be printed…
A: There is no programming language mentioned so we are using c++ as default. This can be solved using…
Q: 1. Trace the following function. Do not just provide the output. Include the state of memory for…
A: Python Memory Usage Information: Python allows displaying the memory storage information where the…
Q: User Prompts Your program will allow a human user to play Rock, Paper, Scissors with the computer.…
A: #Program import random def main(): print('ROCK'+'PAPER'+''+'SCISSORS'+''+'in Python') print()…
Q: 2.11 LAB: Pizza party Given the number of people attending a pizza party, output the number of…
A: Algorithm: 1. Declare number of players,slices,pizzas. 2. Calculate total cost. 3. Print Pizza. 4.…
Q: 5. The program snippet is known as follows: a = 10; b = 1; c = 2; do { b = b + 1…
A: Please make a code generator for the above program fragment. Following is the code generated in c++…
Q: 1. Write a program that prompts the user to enter two points (x1, yl) and (x2, y2) and displays…
A: Here I have taken input from the user and then stored it into 4 different variables. Next, I have…
Q: Write a wholly creative quiz program that consists of three original questions that you make up…
A: Error in the program-Remove the points variable after each fragment of code except the point…
Q: 2.2 Write a program that uses input to prompt a user for their name and then welcomes them. Note…
A: Given : Write a program that uses input to prompt a user for their name and then welcomes them. Note…
Q: Exercise 5: Write a program, which generates and prints a triangle of numbers. The triangle should…
A: The below-given C program will obey the following rubrics: Including necessary header files.…
Q: Complete the convert() function that casts the parameter from a float to an integer and returns the…
A: here in this question we have given a incomplete python code which convert float value to integer…
Q: Edit the program provided so that it receives a series of numbers from the user and allows the user…
A: count=0theSum=0.0while True: number=input("Enter a number or press Enter to quit: ") if…
Q: 2. Complete the function avg5 to return the average of five numbers. Use the accumulator pattern.…
A: # Function to calculate the average of 5 numbersdef avg5(num1,num2,num3,num4,num5): #…
Q: A supermarket is doing a sales promotion for soft drinks. If one day you buy soft drinks and bring…
A: Below is the code in C++ as language not specified and sample output:
Q: 2. Write a console program that reads in an input for value (int) and computes (using mod) if value…
A: We need to read numbers continuously until the user enters a sentinel (0 we choose). The code is…
Q: program3_3.py Write a wholly creative quiz program that consists of three original questions that…
A: The program in python is print("Quiz starts now")answer1=int(input("What is…
Q: 1.Write a program that calculates and produces these two columns sequence numbers using the three…
A: #include <iostream>#include <iomanip> using namespace std; int main(){ cout <<…
Q: 2.12 LAB: Divide by x Write a program using integers user_num and x as input, and output user_num…
A: Required: python Write a program using integers user_num and x as input, and output user_num divided…
Q: Flowchart, create. Writing Functions that Return a Value in Python
A: Start Take input numbers Read the numbers Compute the required operation Store result Print result…
Q: 18. Write a program that allows the user to input two integers, one for the length of the rectangle…
A: Sol 18: The below given C++ program will obey the following rubrics: Including necessary header…
Q: 3. Given the values of three variables a = 2, b = 4, c = 7, write a program to (1) Calculate the sum…
A: I will provide the answer of this question in C++ programming language.
Q: Using switch write a program to insert two float numbers of and an arithmetic effect that refers to…
A: #include <iostream>using namespace std;int main(){ float a,b; char op;…
Q: Q3/ Choose True or False 1. The output of this program is 20? a) True int main(){ b) False int a; a…
A: Note - As per the guidelines we are only allowed to answer 1 question with 3 sub-parts at a time.…
Q: 02: Complete the following code: def calc(a, b): # This function returns the sum and the difference…
A: def calc(a,b): return a+b,a-b
Q: 2. Create an IPO chart based on the problem given below a) Calculator that allow user to perform…
A: IPO(Input, Processing and Output) chart is used to define a function, it acts as a outline for the…
Q: input by the user. (Function) lote: When the user press number 1 - it will print the odd numbers.…
A: void chk(int num[],int ch){ if(ch==1) { Display The odd numbers are: "); for(int…
Q: Q2: Complete the following code: def calc(a, b): # This function returns the sum and the difference…
A: def calc(a,b): return a+b,a-b
Q: Write a program that will perform one of the following operations: 1. Print the Fibonacci series…
A: I give the code in C++ along with output and code screenshot
Q: Lab 14 isalpha () and toupper () functions Write a program that produces the following output. /*…
A: Input : Enter the character from the keyboard until the user wants to enter. Output : For each…
Q: Write a program that calculates the total grade for N classroom exercises as a percentage. The user…
A: C++ is just an object oriented programming language not only based on objects but also based on…
Q: Suppose that int1 and int2 are int variables, dec is a double variable, and ch is a char variable.…
A: The values stored would be int1 = 13 ch = 2 int2 = 4 dec = 16.2
Q: Objects.bxt x 3.50 0.09 3.38 0.04 26.52 0.23 2571.35 1.75 96.95 0.09 An object will float if its…
A: Things to do in the program: Open file in reading mode Read the numbers from file and store it in…
Q: int main (void) float a,b, m; printf("Enter the minor A exam score:"); //input the minor A exam…
A: Code explained below
Q: C++ You are required to write a universal calculator that performs DOUBLE UP of different types of…
A: Add math. h,bits/stdc++.h in your header files section. #include <math.h> #include…
Q: write pseudocode for a program that calculates the sum of all numbers that the user enters. The user…
A: Declare a variable number and a variable to store sum Prompt user to enter a number while…
Q: 4) The price of stocks is sometimes given to the nearest eighth of a dollar; for example, 29 7/8 or…
A: #include<iostream> using namespace std; double stockCost(int x, int y, int z, int stock); void…
Q: 1. Write a program that does the following: - reads an unspecified number of integers - determines…
A: Question -1 #include<stdio.h>int main(){ int a[1000],i=0,count=1,pos=0,neg=0,k=0; float…
Q: Validate an int input using try except (Python) Input Format Input could be characters or numbers.…
A: num = input("Please enter a whole number: ") # taking user input if not…
Q: 5. Write the python code which selects a random number between 1 and 10, once. Prompt the user for…
A: 5.) We have to guess a random number between 1 to 10. For this, we have imported a random package…
Q: int main() { float x,y,z,result; x=y=z=result=0.0; printf("Enter three float numbers:"); scanf("%f…
A: Here have to determine c++ code of given problem.
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number…
A: 1. Input the number of steps and convert it into int and store it in a variable- noSteps 2.…
Q: PART 2: Variables, Constants, and Arithmetic The following are sample runs of the program to help…
A: Program description: Java program, StringFun.java that prompts the user to enter the first name and…
Q: The following code segment is supposed to read all of the integers entered by the user until a blank…
A: The given code segment: values = [] inputstr = input("Enter a value (blank line to quit): ") while…
Q: Using switch write a program to insert two float numbers of and an arithmetic effect that refers to…
A: According to the information given:- We have to compile the given code and find the correct option.
Q: Write one program that will compute both the Least Common Multiple, and the Greatest Common Factor…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
Q: Using switch write a program to insert two float numbers of and an arithmetic effect that refers to…
A:
Q: 4. Write a program called MathExpress that evaluates basic mathematical expressions such as 2+15.1…
A: Program: class AddOp{ public static void main(String[] args) { System.out.println(125 +…
use python
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- 6. Assume a user runs a program containing the following code segment, andenters ‘K’ at the prompt. What is the output? Const char kINDERGARTEN_CODE = ‘k’;Char gradeLevel;Cout << “Enter child’s grade level “;Cin >> gradelevel;If (gradeLevel = = KINDERGARTEN_CODE) cout << “Kindergraten Student “ << endl;else cout << “Older Student “ << eCreate union floating point with members float f, double d and long double x. Write a program that inputs values of type float, double and long double and stores the values in union variables of type union floating point. Each union variable should be printed as a float, a double and a long double. Kindly check if the values always print correctly?// Cornwall.cpp - This program computes hotel guest rates.// Input: None// Output: Hotel guest rate#include <iostream>#include <string>using namespace std;double computeRate(int);double computeRate(int, string);int main() { int days; string mealPlan; string question; double rate = 0.0; cout << "How many days do you plan to stay? " << endl; cin >> days; cout << "Do you want a meal plan? Y or N: " << endl; cin >> question; // Figure out which arguments to pass to the computeRate() function and // then call the computeRate() function cout << "The rate for your stay is $" << rate << endl; return 0;} // End of main() function// Write computeRate functions here.
- 10. Which is correct with respect to the size of the data types?a) char > int < floatb) int < char > floatc) char < int < floatd) char < int < double#include <iostream>using namespace std; double average(int sum_of_grades,int num_grades){return sum_of_grades/(float)num_grades;} int main() {int num_grades,grade,sum=0;char grade_value;cout<<"Enter the number of grades"<<endl;cin>>num_grades;for(int i=0;i<num_grades;i++){cout<<"Enter a numeric grade between 0-100"<<endl;cin>>grade;sum+=grade;}double avg=average(sum,num_grades);if(avg>=90 && avg<=100)grade_value='A';else if(avg>=80 && avg<=89)grade_value='B';else if(avg>=70 && avg<=79)grade_value='C';else if(avg>=60 && avg<=69)grade_value='D';else if(avg>=0 && avg<=59)grade_value='F';cout<<"The grade is "<<grade_value;} review if the written c++ code is correct then organize the code and write comments for each part of the program explaining what they do.Use function GetUserInfo to get a user's information. If user enters 20 and Holly, sample program output is: Holly is 20 years old. #include <iostream>#include <string>using namespace std; void GetUserInfo(int& userAge, string& userName) {cout << "Enter your age: " << endl;cin >> userAge;cout << "Enter your name: " << endl;cin >> userName;} int main() {int userAge;string userName; /* Your solution goes here */ cout << userName << " is " << userAge << " years old." << endl; return 0;} Please help me with this problem using c++.
- 30 Suppose a, b, and sum are int variables and c is a double variable. What value is assigned to each variable after each statement executes? Suppose a = 6, b = 3, and c = 2.2. (14) a b c sum sum = static_cast<int>(a + b + c); __ __ __ __ b += c * a; __ __ __ __ c -= a; __ __ __ __ a *= 2 * b - c; __ __ __ __4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }(Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?
- please do not use java Your program must use the following functions: printHeader(…): prints the two lines header of the table shown in the sampleoutput getData(…): receives a string representing line of text read from file. Itvalidates and returns name, job code and days worked, and a Boolean value ofTrue of the line contains valid data or False if the line contains faulty data. computeSalary(…):receives the job code and days worked and computes and returnsthe employee salary main():Opens input file for reading, reads data from file, calls variousfunctions and prints resultsI am having trouble having this code run correctly. I need some assistance as I am now lost. main.cpp #include "ScoreStatistics.cpp"#include <iostream>int main() {int ch=1;string names[100];float scores[100];int numberStudents=0;while(ch!=4){cout<<"1. Enter the test scores via a user prompt\n";cout<<"2. Display grade roster\n";cout<<"3. Display statistics\n";cout<<"4. Exit\n";cout<<"Your choice: ";cin>>ch;if(ch==1){numberStudents=enterTestScoresViaUserPrompt(names,scores);}else if(ch==2){displayGradeRoster(scores,names,numberStudents);}else if(ch==3){displayClassStatistics(scores,numberStudents);}else if(ch==4){ }else{cout<<"Wrong menu item.\n\n";}}return 0;} ScoreStatistics.cpp #include "functions.hpp"#include <iostream> char getGrade(float score){if(score>=90 && score<=100){return 'A';}if(score>=80 && score<=89){return 'B';}if(score>=70 && score<=79){return 'C';}if(score>=60…(Temperature Conversions) Write a program that converts integer Fahrenheit temperaturesfrom 0 to 212 degrees to floating-point Celsius temperatures with 3 digits of precision. Perform thecalculation using the formulacelsius = 5.0 / 9.0 * (fahrenheit - 32);The output should be printed in two right-justified columns of 10 characters each, and the Celsiustemperatures should be preceded by a sign for both positive and negative values.