"XYZ" Company is planning to raise its employees' salaries based on the following percentage basis: - Bonus: 5% from total salary - Transportation 2% from total salary The program has to display the total salary by reading from user the number of hours and the rate. (totalPrize= nbHours * Rate) Sample Runl: Enter number of hours and rate: 15025 Total salary: $3750 Bonus: 187.5, Transportation: 75 Total after raise: $4012.5 Sample Runl: Enter number of hours and rate: 10040 Total salary: $4000 Bonus: 200, Transportation: 80 Total after raise: $4280
Q: setprecision (n) : when used in conjunction with fixed, set the number of digits after the decimal…
A: Below is the code and sample output:
Q: Q2/ Write new code have the same effect .for the following by using IF q2 int main() { int score;…
A: We will write the new code which will have the same effect but it will use if.
Q: The date June 10, 1960, is special because when it is written in the following format, the month…
A: <!DOCTYPE html> <html> <head> <title>Special Date…
Q: int main() { int i, salary[10], range[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; double gross[10], total[10];…
A: The regular expression (RE) contains the symbol 0 and 1 only. The expression is:…
Q: Write a C++ code based on the Sample Dialog Validate input. Offer to "Try Again". SAMPLE…
A: #include <iostream>//header file to include setprecision#include<iomanip> using…
Q: Reza Enterprises sells tickets for buses, tours, and other travel services. Because Reza frequently…
A: Algorithm: Start READ Num Compute: lastDigit = Num % 10 Compute: modNum = Num / 10 IF modNum% ==…
Q: int x = 2; int y = 8; Ilprint x and y values at this point while (x+y < 20)}{ x = x + 2; y = y - 1;…
A: a)Trace of the given program:initially x and y : 2,8now x=2,y=8x+y<20 : 10<20 is…
Q: The factorial of n is the product of all the nonnegative integers from 1 to n. for 8! = 1 * 2 * 3 *…
A: Given: The factorial of n is the product of all the nonnegative integers from 1 to n. for 8! = 1 * 2…
Q: 2- W.P to reverse the digits order of the 4 digits number you entered? 3- W.P to read two integers…
A: Logic: use % operator to get remainder. Use / operator to remove last digit set rev=0 while(n>0)…
Q: Assume that you have price distributions as follows: (000 - 299 $), (300 – 599 $), (600 – 899 $),…
A: Program approach:- Using the necessary header file. Define the main function. Displaying STAR for…
Q: Please I Need the flowchart for this code #include #include #include void main() {…
A: INTRODUCTION: A flowchart depicts the individual phases of a process in chronological sequence.…
Q: nput a value for the variable y so that the variable x becomes 4 after the code executes.…
A: According to the Question below the Solution:
Q: Q1 Election Commission of Malaysia (SPR) wants to develop a registration of voter’s program. To…
A: Rectangle: a process Parallelogram: input/output Oval: start/ end Diamond: Decision making
Q: Write an application that displays the factorial for every integer value from 1 to 10
A: A factorial of a number is the product of that number multiplied by each positive integer lower than…
Q: Employees of Burger King are paid by the hour. Normally, they work 40 hours or less per week.…
A: Pseudocode: Pseudocode of the program is basically a technique of writing a program informally. It…
Q: Assume there is a variable, h that has already been assigned a positive integer value. Write the…
A: In step 2, you will get python code. In step 3, you can see the sample output.
Q: Puma Filling Station sells gasoline and has a car wash. Fees for the car wash are K40.00 with a…
A: Pseudocode: Input number of liters purchased Input kind of gasoline purchased Input car wash…
Q: In the following code snippet, where comments indicate line numbers: uint64_t x = 2; uint64_t y = 5;…
A:
Q: A mail order house sells five different products whose product numbers and retail prices are:…
A: C++ used to answer this question
Q: Orinoco rewards loyal customers with discounts as shown in the table below. Write a program that…
A: """Program that prompts shoppers for the price of a purchase and their accumulated loyalty points.…
Q: Shannon and Jasmine bowl as a team. Each of them bowls three games in a tournament. They would like…
A: For this program we need 6 inputs, 3 of shannon and 3 of jasmine. And then we need to do some…
Q: This assignment requires you to plot (in text) a quadratic function at certain points. • Ask the…
A: Correct code def q(a,b,c,x): return a*x**2 + b*x +c def pq(a,b,c,x): print(f'At x= {x} ,y=…
Q: Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen…
A: Program code: //Import the required Java package import java.util.Scanner; //Class definition class…
Q: What does the following code print out? $cash on hand = 31; $meal = 25; $tax 10; $tip 10; while (…
A: 1) Code in question does below activity It defines below variables and assign them values…
Q: 3- How many the number of erTors in the following sub_ program? Hinclude void main( ) intnum, sum -…
A: the answer is option d 7
Q: You are required to take two strings input from the user at runtime, later display a menu to the…
A: Java is a platform and a programming language. Java is a general-purpose programming language that…
Q: What will the following Code segment print on the screen? int P = 30; int Q = 20;…
A: Given data: int P = 30;int Q = 20;System.out.println("Your Total purchase is \n" + (Q*P) +"…
Q: How should I edit my C++ code below? It displays the incorrect math answer to the fare.…
A: The question is to correct the given C++ code.
Q: (Compute e) You can approximate e* using the following series: x? x ex = 1 + 1! 2! 3! 4! n! Write a…
A: PROGRAM CODE: #include <iostream> // include header file for input output…
Q: Please comment all of the following code by using multiple line comment symbol. 1/1 int main() {…
A: Commenting the line of code with multiple line comment in c++
Q: int x = 5, y = 2, z = 3; if ( x z) cout 2 ) { cout << z <<" "<< y-x << endl; cout << z * (x + y)<<…
A: The program is written in C++ Language. Please find the source code and output in the below steps
Q: A long-distance carrier charges the following rates for telephone calls between the United States…
A: Given: To write a program that asks for the starting time and the number of minutes of the call,…
Q: Assume that you have price distributions as follows: (000 - 299 $), (300 – 599 $), (600 – 899 $),…
A: ALGORITHM:- 1. Take input for each occurences. 2. Check if the input is greater than 50. 3. Print…
Q: 6. Prompt user to enter an integer number from console. Adjust this number if it is not in the…
A: Below is the complete solution with explanation for the given question in detail.
Q: 10 % discount. If the user purchases butter and flour he will get 15% discount. Otherwise, there is…
A: import java.util.Scanner;public class MyClass { public static void main(String args[]) {…
Q: What is the output [x] of the following segment of code if 6 is input by the user when asked to…
A: While doing programming in any programming language, you need to use various variables to store…
Q: a) A local shop sells festival cookies at RM28.50 per box. The shop offers special discount for…
A: As per the requirement program is written. Algorithm: Step 1: Write the main() method Step 2: Print…
Q: Q1 Election Commission of Malaysia (SPR) wants to develop a registration of voter’s program. To…
A: Variations in Voter Identification Laws Voter ID laws can be categorized in two ways. First, the…
Q: Employees of Burger King are paid by the hour. Normally, they work 40 hours or less per week.…
A: Declare Total_Hours_Worked as integer Declare Hour_Wage_Rate as double Write “Enter total hours…
Q: Q2: Write a code program to calculate and display the value of (S) from the following series. 1-…
A: The solution to the given problem is below.
Q: // A standard mortgage is paid monthly over 30 years. // This program is intended to display 360…
A: Answer: for(int i=0; i<30;i++)//this loop is for the year for(int i=0;j<12;j++) printf("the…
Q: Q2/ Write new code have the same effect .for the following by using IF q2 int main() { int score;…
A: - We have to do the following code in c++ with if statements.
Q: Identify the correct statement for varjable initialization from the following? O a. 38.7=heat O b.…
A: Question is about how variable initialisation is done. We are given 4 option lets see:
Q: Sandwich Maker Write a program that asks users for their sandwich preferences. The program should…
A: The advantage of Python allowing elements of a list to be of various types is that we can store all…
Q: Write a program to: Prompt the user for each employee’s id (an integer value) and the sales…
A: C++ Program Code: #include<iostream>#include<iomanip>#define MAX 20using namespace std;…
Q: software company sells a package that retails for 599. Quantity discounts are given according to the…
A: According to the question we have to write C++ code for following question:
Q: Suppose you shop for rice in two different packages. You would like to write a program to compare…
A: import java.util.Scanner; public class Exercise_1{ public static void main(String[] args)…
Q: "Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen…
A: Take egg quantity input from the user. As dozen = 12, Calculate dozen by dividing total eggs by 12.…
Step by step
Solved in 6 steps with 3 images
- In Chapter 4, you created a program that generates a random number, allows a user to guess it, and displays a message indicating whether the guess is too low, too high, or correct. Now, create a modified program called GuessingGame2 in which the user can continue to enter values until the correct guess is made. After the user guesses correctly, display the number of guesses made. Recall that you can generate a random number whose value is at least min and less than max using the following statements: Random ranNumber = new Random(); int randomNumber; randomNumber = ranNumber.Next(min, max);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; }Mortgage bond L, interest rate r =15%. The fixed payments P to pay off the loan over N years is given by P= rL(1+r/12)^12N/12(1+r/12)^12N -1) a)Write a code to compute and print P if N = 20 and the bond is $50,000 b) how P changes with N . Can you find a value for which the payment is less than $625? c) go back to N =20 and examine for different interest rate . Raising the interest rate increase the payment by $37?
- A polynomial is given by f=(8.5×v×v)−(7.0×v)+3.5. Declare double variables v and f. Then, read v from input and compute f using the polynomial. Ex: If the input is 1.0, then the output is: 5.000 #include <iomanip>#include <cmath>#include <iostream>using namespace std; int main() { /* Your code goes here */ cout << fixed << setprecision(3) << f << endl; return 0;}Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00 Note: Real per-mile cost would also include maintenance and depreciation.Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to pointsDistance. The calculation is:Distance = SquareRootOf( (x2 - x1)2 + (y2 - y1)2 ) #include <stdio.h>#include <math.h> int main(void) { double x1; double y1; double x2; double y2; double xDist; double yDist; double pointsDistance; xDist = 0.0; yDist = 0.0; pointsDistance = 0.0; scanf("%lf", &x1); scanf("%lf", &y1); scanf("%lf", &x2); scanf("%lf", &y2); /* Your solution goes here */ printf("%lf\n", pointsDistance); return 0;
- Assume that you have price distributions as follows: (000 - 299 $), (300 – 599 $),(600 – 899 $), (900 $).Write a program asking the user to enter the number of occurrences of the abovedistribution, and represent that as STARS “*” for each occurrence in front of eachdistribution. Note:1- Use printf to format each distribution automatically as you learned before.2- If the number of occurrencesfor a distribution is more than 50, the programshould write the word “BINGO!”.this is the program, only problem is that I am not able to get Your total is 22 out of 30, or 73.33%. this statment, can you please help? 13.Write a program that calculates the total grade for N classroom exercisesas a percentage. The user should input the value for N followed by each ofthe N scores and totals. Calculate the overall percentage (sum of the totalpoints earned divided by the total points possible) and output it as a percentage.Sample input and output is shown below.How many exercises to input? 3Score received for exercise 1: 10Total points possible for exercise 1: 10Score received for exercise 2: 7Total points possible for exercise 2: 12Score received for exercise 3: 5Total points possible for exercise 3: 8Your total is 22 out of 30, or 73.33%. my solution. //declare variablesstring exercise1;string exercise2;string exercise3;string exercises;string totalexercise1;string totalexercise2;string totalexercise3;string yourtotal;yourtotal = exercise1 + exercise2 +…A prime number is called a Mersenne prime if it can be writtenin the form 2p - 1 for some positive integer p. Write a program that findsall Mersenne primes with p ≤100 and displays the output as shown below.(Hint: You have to use BigInteger to store the number because it is too big tobe stored in long. Your program may take several hours to run.) p 2^p – 1---------------------2 33 75 31...
- What's wrong in my code?? #include <iostream> using namespace std; int main (){int basicSalary, bonus = 0, years, newsalary;char gender;cout << "Enter the basic salary amount: ";cin >> basicSalary;cout << "Enter the number of years: ";cin >> years;cout << "Enter if the employee is F for Female or M for Male: ";if(years > 5 && gender == 'F')bonus = years * 20;else (years < 5 && gender == 'F')bonus = years * 10;else(years > 5 && gender == 'M')bonus = years * 40;else(years < 5 && gender == 'M')bonus = years * 20;newsalary = basicSalary + bonus cout << "Bonus amount is: " << bonus;cout << "The new salary is " << newsalary; return 0;}Fox International sells pre-paid calling card with the following features: Calls to USo 1.2 cents per minute plus a 49 cent connection fee per call Calls to Europeo 2.3 cents per minute plus a 49 cent connection fee per call Calls to Australiao 6.4 cents per minutes plus a 49 cent connection fee per callWrite a program that work out the charges for the month. The program should accept the followinginformation: Account holders name Card number Starting Balance on card For US callso Total number of minutes of all callso Total number of calls made For European callso Total number of minutes of all callso Total number of calls made For Australian callso Total number of minutes of all callso Total number of calls madeYou are NOT expected to error check your inputs for this assignment. (e.g. checking for negative values,etc.). There is NO GST charged on the calls as the GST was paid when the card was purchased.Format of output:Review the test plan to see how the user would like the…* consider the following code * #include <iostream>using namespace std;int main(){ double wages, hours, OThours, OTamount, totalWages; double rate = 20.00; double OTrate = rate * 1.5; cout << "how many hours did you work this week?" << endl; cin >> hours; if (hours > 0 && hours <= 40) { wages = (rate * hours); totalWages = wages; } else if (hours > 40 && hours <= 60) { wages = (rate * 40); OThours = (hours - 40); cout << "OTHours = " << OThours << endl; OTamount = (OThours * OTrate); cout << "OTamount = " << OTamount << endl; totalWages = (wages + OTamount); } cout << "totalWages = " << totalWages << endl;} What is the OTamount if 50 hours were worked?