Concept explainers
The following
const double PI= 3.14159;
double degrees, radians;
cout << "Enter an angle in degrees and I will convert it\n";
cout << "to radians for you: ";
cin >> degrees;
radians = degrees* PI / 180;
// Display the value in radians left-justified, in fixed-point
// notation, with four decimal places of precision, in a field
// seven spaces wide.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
Degarmo's Materials And Processes In Manufacturing
Starting Out with C++ from Control Structures to Objects (9th Edition)
Mechanics of Materials (10th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Electric Circuits. (11th Edition)
- (Civil eng.) Write an assignment statement to calculate the linear expansion in a steel beam as a function of temperature increase. The formula for linear expansion, l, is as follows: l=l0(1+(TfT0)) l0isthelengthofthebeamattemperatureT0.isthecoefficientoflinearexpansion.Tfisthefinaltemperatureofthebeam.arrow_forward(Misc. application) a. Write a program to reverse the digits of a positive integer number. For example, if the number 8735 is entered, the number displayed should be 5378. (Hint: Use a do statement and continuously strip off and display the number’s units digit. If the variable numinitially contains the number entered, the units digit is obtained as (num % 10). After a units digit is displayed, dividing the number by 10 sets up the number for the next iteration. Therefore, (873510)is5and(8735/10)is873. The do statement should continue as long as the remaining number is not 0.) b. Run the program written in Exercise 3a and verify the program by using appropriate test data.arrow_forward4. 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; }arrow_forward
- Python questionarrow_forwardTranscribed Image Text Write a program that asks for the principal, the annual interest rate, and the number of times the interest is compounded. It should display a report similar to the following: Interest Rate: 4.25% Times Compounded: 12 Principal: $ 1000.00 Interest: 43.33 Final balance: $ 1043.33arrow_forwardThe following code will display 10: int a = 10; int *b = &a; cout << *b++; Select one: True Falsearrow_forward
- 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 Outputarrow_forwardConsider the following code segment: of int numFeet, numInches; //number of feet // number of inches int totalInches -52; //total number of inches Write the statements to convert the total number of inches to feet and inches: a) Calculate the number of feet, and store the result in numFeet. b) Calculate the remaining number of inches, store the result in numinches.arrow_forwardThe following C code computes the value of f(x)=e3x for the given x number using Maclaurin series expansion. The code finds the approximate solution and the relative error in each iteration until supplying error tolerance. So, fill in the blanks. #include #include double Factoriel(int n) { if return 1; else return n * Factoriel(n - 1); } int main() { double x; double ref_error, error; double actual_value, approximate_value; printf("x degerini giriniz\n"); scanf_s("%lf", &x); printf("Referans hatasini giriniz\n"); scanf s("%lf", &ref_error);arrow_forward
- Fy F= 40N 75 mm Fx 325 mm Figure 1 F = (4/5)F and F, = /5)F Total Moment at B = F,dy + (-F,)d, Where d, and dy, are the perpendicular distance in meter. In this example it is given that d, = 175mm and dy = 325 mm. As a programmer it is your responsibility to write a code to solve for the total moment at B. The requirement to find the total moment is as follows: 1) Please write a code using object-oriented programming to solve for the total moment. (You can test your code using the data given above.) 2) Declare a class, Moment. 3) The user needs to enter the information for the d, and d,. Write a statement to ask the user on the number of data that the user want to calculate the moment with different n values of d, and dy. 4) Declare a constructor to initialize the input, decide which one of the inputs that you want to use constructor for the initialization. 5) Print the output to the screen and a datafile name TotalMoment.txtarrow_forwardExercise I- Medicine Write a program that asks the user to enter the name of the medicine (t for ThroX, f for FeliX), his mass. The user should enter as well if he has a prescription or not. The program will calculate the dosage using: age and his ThroX without prescription -The max dosage should be 0.75 mL -The dosage = mass / 150 -The number of pills per day to take is 1 ThroX with prescription -The dosage =mass * 3 / 150 -The number of pills per day to take is 5 FeliX with prescription -The dosage = 0.77 mL FeliX without prescription -The dosage should be between 0.3 and 0.7 -The dosage = mass * 0.009 -The number of pills per day to take is 2 -The number of pills per day to take is 6 The program should display the dosage and the number of pills to be taken per day if the requirements are full filled, otherwise it display "Please check your doctor for a prescription". In case the medicine does not exist in the database, the program display “Your medicine is not in our database!"…arrow_forwardLab activity: Driving costs Code in main.py, attach output.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,