Area Calculator: Prompt the user to enter two choices 1 or 2. If user enters 1 then ask him for length of side of square and if user enters 2 then prompt for length and breadth of rectangle. In both case the output should be the area of square (case 1) or rectangle (case2). In C++
Q: Guess The Number Game: write a C++ program that will ask the user to guess a secret number randomly…
A: #include<iostream> using namespace std; int main(){ int guess,score_p,score_c,random,i;…
Q: Multiple Choice: In the following code, how does the value of x or y change after exeCuting public…
A: While doing programming in any programming language, you need to use various variables to store…
Q: Body Mass Index (BM) is a measure of health on weight. It can be calculated by taking your weight in…
A: Here is the java code. See below step for code.
Q: What is the output from the following code segment if the user enters 8
A: According to the question we need to find the output from the following code segment if the user…
Q: Description Write a program that asks the user to enter an amount of money in the format of dollars…
A: Program: # Asking for a dollar and cent amount from the user # Prompting a message to enter a amount…
Q: Part B: Chore Bonus Your parents pay you $3 for each trash bag full of leaves you rake. If you can…
A: According to the information given:- We have to follow the instructions mentioned to get the desired…
Q: Randomly generate a number. If this number is in range [1, 12], map it to a month name and display,…
A: I have provided JAVA CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: (Geometry: great circle distance) The great circle distance is the distance between two points on…
A: The Java program is written where it takes the latitude and longitude degrees from the user for the…
Q: Programing Language: C++ Your time machine is capable of going forward in time up to 24 hours. The…
A: #include <iostream>#include <iomanip> using namespace std; int computeDifference(int…
Q: c++ programming if…else and switch case are types of conditional selection statements used in many…
A: All the questions are coded in C++.
Q: ACE balloon shop sells balloons to customers at 10 Fils cach. If the customer buys 500-1000…
A: Please find the answer below :
Q: Write a program to calculate electricity charges for a customer. The program requests a name,…
A:
Q: (Cost of driving) Write a program that prompts the user to enter the distance to drive, the fuel…
A: Since, the programming language is not mentioned, below is the complete c++ program:
Q: Write a C program that allows the user to enter values for the width and length of a wall in feet…
A: The required C program should generate a paint calculator in the output. It needs user input for the…
Q: C++ Angle Calculator Write a program that asks the user for an angle, entered in radians. The…
A: C++ Angle Calculator Write a program that asks the user for an angle, entered in radians. The…
Q: USING C++ PROGRAMMING LANGUAGE A mobile phone service has three different data plans for its…
A: Given Plans are: PLAN A: For $19.99 per month, 2 gigabytes are provided. Additional usage…
Q: Nice Number Programming: Nice program ask user to enter three integers from keyboard (java console),…
A: Below is the required java program. Program Approach: Import necessary packages to get the standard…
Q: Mars hyper market gives discount to customers based on their spending. If a customer spends 20 Omani…
A: #include<iostream>using namespace std;int main(){ float spending; cin>>spending;…
Q: In C++ (Find the number of days in a month) Write a program that prompts the user to enter the…
A: Answer: This is my answer: But the complier reported: 1. Compiler error : fatal error 2. #include 3.…
Q: Medication dosage by weight A machine administers medication dosage based on weight. Write an…
A: According to the question given:- we have to create program for Medication dosage by weight For that…
Q: code for this in C: In college, a student may get a grade of 1.0 (as the highest) to 5.0(lowest).…
A: PROGRAM CODE: The challenge is how to use the supplied formula to highlight the final grade, and…
Q: Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight…
A: Below I have provided Java Programming. Also, I have attached the screenshot of the code and output…
Q: switch statement C++ that will loop the case
A: A switch statement allows a variable to be compared against a list of values for equality. Each…
Q: Types of charges Room charges : Junior suite Deluxe suite Executive suite Critical care units:…
A: Since you have posted a question with multiple sub-parts, we will solve first three subparts for…
Q: Exercise 4: Temperature Humidity (H) Weather (T) 16 20 Cold 22 40 Normal 35 75 Hot Write a C++…
A: CODE #include<iostream>using namespace std; int main(){ int temp, hum; cout << "Enter…
Q: ACE balloon shop sells balloons to customers at 10 Fils each. If the customer buys 500-1000…
A: As per the requirement program is completed in c++. Algorithm: Step 1: Write the main() method Step…
Q: Complete the following program When a machine reads blood pressure from a human body it displays two…
A: C++ pass by reference: Pass by reference is the type of calling the function with the address of…
Q: (Apartment problem) A real estate office handles , say, 50 apartment units. When the rent is, say,…
A: PROGRAM: //Header file #include <iostream> #include<iomanip> //Using namespace using…
Q: Write a program that randomly generates a lottery between 100 and 999 (random.randint(100, 999)),…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: program that reads an integer sum in dollars and displays how many dollars bills of $100, $50, $20,…
A: program that reads an integer sum in dollars and displays how many dollars bills of $100, $50,…
Q: 5. (Algebra: solve 2 x 2 linear equations) You can use Cramer's rule to solve the following 2 X 2…
A: Input the numbers from the user, split the number and convert them into float. unzip the list item…
Q: Your program will prompt the user for the following information: current population number of…
A: 1) Below is python program to prompt the user for population, birth death and years to predict…
Q: using namespace std; int main () { int x = 3; if (!x) if (x = 4) cout << "AAA"; else cout << "BBB";…
A: Code is given:
Q: Q7-Write a program that simulates a simple calculator. It reads two integers and a character. If the…
A: // Always mention the language of the program, for now, I am doing it in C++ // Code #include…
Q: Question: ACE balloon shop sells balloons to customers at 10 Fils each. If the customer buys…
A: Given: Write a C++ program to read no. of balloons to purchase and print the amount of bill in BD.
Q: atures of the water. The formula to compute the energy is Q = M * (finalTemperature –…
A: Code: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Guess the number Write a C program that plays the game of "guess the number" as follows. Your…
A: Answer : I have provided c code with comment which will be easily understood the code : I have…
Q: C++ OOP Write a program that prompts the user to input a length expressed in centimeters. The…
A: Program plan: Prompt for the centimeter value Converts the centimeter length to inch lengthInch…
Q: Car sales commission problem - For each used car a salesperson sells, the commission paid is as…
A: As per our policy, we can answer only one question if want an answer for the second question you can…
Q: C# Question Write a statement that declares a variable words and initialize it to the following…
A: Here is the statement that declares a variable words and initialize it to the following list of…
Q: Day Calculation Background - Many times one needs to do calculations on dates. Programs like Excel…
A: Program Description : The C++ program prompts the user to enter day, month, and year values from the…
Q: Problem Description: The bird of paradise called the Helipixsal is renowned for its magnificent tail…
A: lengths of feathers looping conditions output Explanation: The code is: def main(): num_feathers =…
Q: Q3. Write a C program that displays the menu shown in the example run, to the user, with the…
A: C-programming is a general-purpose,procedural,imperative computer programming language.
Q: 1- If money is left in a particular bank for more than 5 years, the bank pays interest at a rate of…
A: The C programming language is a computer programming language that was developed to do system…
Q: Write a C++ program to estimate your water bill for next quarter. Your water meter measures the…
A: #include <iostream>#include <cmath> using namespace std;int maxallo = 50; //declaring…
Q: The greatest common divisor, also known as GCD, is the greatest number that will, without a…
A: HI, Since you did not mentioned language i used 'C'
Q: [Question Description] Enter any number of integers with three digits and determine whether they are…
A: Below is the complete solution with explanation in detail for the given question about palindrome.…
Q: g. the C++ statement/s that declares your variables
A: Variable: The data object whose value can be changed by the user, statement, or expression…
Q: Write a program that prompts the user to enter the edges of a triangle and compares them. If all…
A: In the solution of given problem, we need to use Else-If ladder statement to test the conditions. An…
Q: The Fibonacci sequence is: 0, 1, 1, 2, 3, 5, 8, 13, … The first two terms are 0 and 1, and each term…
A: Introduction of the Program: The C++ program takes the value of the Fibonacci index as input from…
Area Calculator:
Prompt the user to enter two choices 1 or 2. If user enters 1 then ask him for length of side of square and if user enters 2 then prompt for length and breadth of rectangle. In both case the output should be the area of square (case 1) or rectangle (case2).
In C++
Step by step
Solved in 4 steps with 3 images
- A pair of primes that vary by two is a pair of twin primes (e.g., 3 and 5, 101 and 103). Write a C++ application that displays the total number of twin primes smaller than 1000.Computer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Output-scripting language Write a program that randomly generates a lottery between 100 and 999 (random.randint(100, 999)), prompts the user to enter a number in the same range, and determines whether the user wins according to the following rule: (1) If the user input matches the lottery in exact order, print "the award is $10,000". E.g., lottery = 123, input = 123(2) If the user input matches the lottery, but in wrong order, print "the award is $6,000". E.g., lottery = 123, input = 321(3) If two digits in the user input matches a digit in the lottery, print "the award is $3,000". E.g., lottery = 123, input = 612(4) If one digit in the user input matches a digit in the lottery, print "the award is $1,000". E.g., lottery = 123, input = 289(5) If none of the digits is matched, print "thank you".
- 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; }(Data processing) Years that are evenly divisible by 400 or are evenly divisible by 4 but not by 100 are leap years. For example, because 1600 is evenly divisible by 400, 1600 was a leap year. Similarly, because 1988 is evenly divisible by 4 but not by 100, it was also a leap year. Using this information, write a C++ program that accepts the year as user input, determines whether the year is a leap year, and displays a message telling the user whether the entered year is or is not a leap year.(Physics) Coulomb’s Law states that the force, F, acting between two electrically charged spheres is given by this formula: F=kq1q2r2 q1isthechargeonthefirstsphere.q2isthechargeonthesecondsphere.risthedistancebetweenthecentersofthetwospheres.kisaproportionalityconstant. Write an assignment statement to calculate the force, F.
- C-Program for blood pressure. The program (screenshot below) compares the systolic & diastolic measurements to output whether the blood is (low, ideal, pre-high, or high) The code I wrote is able to successfully determine the blood pressure type as long as it lies within the same range. However, if it goes outside that range it prints an error. FOR EXAMPLE**** PLEASE READ*** If the user inputs their systolic variable as 100 and their systolic as 90, it will print an error. If the systolic & diastolic measurements are vastly different the program prints an error, if you could help resolve this issue it would be greatly appreciated.In order for the bulb to work, 3 buttons must be pressed and the button values must provide exactly the required energy, there should be no more or less. It is assumed that the buttons are pressed simultaneously, the order is not important. If the required energy is provided with the entered button values, the program should output "Bulb On", if not, "Bulb Does Not Light" output. Code the program in C language, following the rules below. 1. The number of buttons and their values will be taken from the user.2. The energy required for the bulb to work will be taken from the user.3. You have to design the program RECURSIVE.4. The triple button groups that provide the required energy do not have to be listed, it is sufficient to send a message to the screen(Apartment problem) 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: The total number of units. The rent to occupy all the units. The increase in rent that results in a vacant unit. Amount to maintain rented unit. The program then outputs the number of units to be rented to maximize the profit.
- C++ Programming Problem: To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 255-5466 can be displayed as CALL HOME, which uses eight letters. Write a program that prompts the user to enter a telephone number expressed in letters and outputs the corresponding telephone number in digits. If the user enters more than seven letters, then process only the first seven letters. Also output the hyphen after the third digit. Allow the user to use both uppercase and lowercase letters as well as spaces between words. Moreover, your program should process as many telephone numbers as the user wants.In C++ (Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, if the user entered month 2 and year 2012, the program should display February 2012 has 29 days If the user entered month 3 and year 2015, the program should display March 2015 has 31 daysc++ programming if…else and switch case are types of conditional selection statements used in many programming languages such as C++. Write your own codes for question (a), (b) and (c) to demonstrate how the selection statement works. (a) Using if….else selection statement, allow user to key in a number then check whether the number is positive or negative number. (b) Using if….else...if selection statement, allow user to key in a mark for one subject and display the grade for the subject. A for >80, B for >60, C for >50, D for >40, F for <40 .. (c) Using nested if..else selection statement, ask user to key in their age. Then define whether the user should go to nursery, primary school, secondary school or university based on their input. (d) Using switch case selection statement, allow user to key in a mark for one subject and display the grade for the subject. A for >80, B for >60, C for >50, D for >40, F for <40 .