What is the output of the following
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
C++ Programming: From Problem Analysis to Program Design
- Give an example from your own idea, of a program that use a void function (does not return avalue), based on your understanding. (You must include a main function)arrow_forwardDefine an enumeration type triangleType that has the values scalene, isosceles, equilateral, and noTriangle.b. Write a function triangleShape that takes as parameters three numbers, each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note: In a triangle, the sum of the lengths of any two sides is greater than the length of the third side.)c. Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangle.arrow_forward6. In Java, you have the opportunity to either use a predefined function/method or write a user-defined function/method. In this discussion, provide at least three criteria that would be used to develop an appropriate method of your choice and the rationale behind the selection of these criteria.arrow_forward
- - Pure Javascript in console- Use camelCase- use functions to call each case- all cases must be user inputarrow_forwardImplement in C Programming 7.6.1: LAB: Simple car Given two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar variable that performs the following operations: Drives input number of miles forward Drives input number of miles in reverse Honks the horn Reports car status SimpleCar.h contains the struct definition and related function declarations. SimpleCar.c contains related function definitions. Ex: If the input is: 100 4 the output is: beep beep Car has driven: 96 miles main.c #include <stdio.h> #include "SimpleCar.h" int main() { /* Type your code here. */ return 0;} SimpleCar.h #ifndef SIMPLE_CAR_H#define SIMPLE_CAR_H typedef struct SimpleCar_struct { int miles;} SimpleCar; SimpleCar InitCar();SimpleCar Drive(int dist, SimpleCar car);SimpleCar Reverse(int dist, SimpleCar car);int GetOdometer(SimpleCar car);void HonkHorn(SimpleCar car);void Report(SimpleCar car); #endif SimpleCar.c #include…arrow_forwardIn Go Lang, 3. Write regular expressions for the following -- using the extensions for regular expressions that libraries support is fine: · Dimensions of most products on the Home Depot website, with H for height, W for width, and D for depth. Ex: H 32.7 in, W 80.3 in, D 31.5 in · A citation for lines from a play: • A listing inside parentheses of: the title of the play, a space, and the act, scene and line numbers, separated by periods. • If there is more than one line, it is specified by the first line, a dash(-) and then the last line. • Example: (Six Degrees of Separation 1.3.188-90)arrow_forward
- in Haskell: rewrite the following function in two different ways: 1. as a sequence of transformations using the explicit application operator ($) 2. as a composition of functions using the "dot" composition operator (.) stringToInt s = reverse [ord x - 48 | x <- s] stringToIntRec x (head : tail) = (x * head) + (stringToIntRec' (x*10) tail) stringToIntRec x [] = []arrow_forwardCreate a multiplication operator function for the Complex class in Program 11.8 that multiplies two complex numbers. Use the relationship that (a + bi) × (c + di) =(ab − bd) + (ad + bc)i.b. Include the function constructed for Exercise 4a in a complete C++ program. #include <iostream> #include <iomanip> using namespace std; //declaration section class Complex { private: double realpart; double imaginarypart; public: Complex(double real = 0.0, double imag = 0.0) { realpart = real; imaginarypart = imag;} void showcomplexvalues(); //accessor prototype void assignnewvalues(double real, double imag) //inline mutator { realpart = real; imaginarypart = imag;} }; //End of the class declaration //Implementation section void Complex::showcomplexvalues() //Accessor { char sign = '+'; if (imaginarypart < 0) sign = '-'; cout << realpart << ' ' << sign…arrow_forwardQ1) Write a function called letter grade that has a type int input parameter called points andreturns through an output parameters gradepLetter and gradepNumber. The appropriate lettergrade matching is given in the table below. Return through a second output parameter(just_missedp) an indication of whether the student just missed the next higher grade (true for89, 79, 64 and so on).Prototype: void letter_grade(int points, char *gradepLetter, char*gradepNumber, char *just_missedp);arrow_forward
- Q2 Write the pseudo-code of Q1 using C++ language supposing that you have the following variables and functions already defined: A1: the distance from target A2: the angle to target MOVEFORWARD: to move forward TURN(VAL): to turn right or left. If the parameter is positive it turns to the right, else to the left.arrow_forwardImplement in C Programming 6.10.2: Pass by pointer. Write a function call to ConvertMoney() to store the number of quarters, nickels, and pennies within the integer variables numQuarters, numNickels, and numPennies, respectively. Ex: If the input is 133, then the output is: Quarters: 5 Nickels: 1 Pennies: 3 #include <stdio.h> void ConvertMoney(int totalPennies, int* numQuarters, int* numNickels, int* numPennies) { *numQuarters = totalPennies / 25; totalPennies = totalPennies % 25; *numNickels = totalPennies / 5; totalPennies = totalPennies % 5; *numPennies = totalPennies;} int main(void) { int totalPennies; int numQuarters; int numNickels; int numPennies; scanf("%d", &totalPennies); /* Your code goes here */ printf("Quarters: %d\n", numQuarters); printf("Nickels: %d\n", numNickels); printf("Pennies: %d\n", numPennies); return 0;}arrow_forwardThis is in C++ given main(), define the Team class (in files Team.h and Team.cpp). For class member function GetWinPercentage(), the formula is: teamWins / (teamWins + teamLosses) Use casting to prevent integer division. Ex: If the input is: Ravens 13 3 where Ravens is the team's name, 13 is number of team wins, and 3 is the number of team losses, the output is: Congratulations! Team Ravens has a winning average! If the input is Angels 80 82, the output is: Team Angels has a losing average. The template provided is this: #include <iostream>#include <string>#include "Team.h"using namespace std; int main(int argc, const char* argv[]) {string name;int wins;int losses;Team team; cin >> name;cin >> wins;cin >> losses; team.SetTeamName(name);team.SetTeamWins(wins);team.SetTeamLosses(losses); if (team.GetWinPercentage() >= 0.5) {cout << "Congratulations, Team " << team.GetTeamName() <<" has a winning average!" << endl;}else {cout…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr