Purchase Solution

Compile and run the program.

Not what you're looking for?

Ask Custom Question

It contains the C++ wages program using a repeat loop in order to enable the user to compute several wages. The loop ends when the user enters -1 for either the hours_worked or the pay_rate. C++ uses the "do" keyword instead of "repeat".

/* Program to compute the weekly wages repeatedly */
/* */
/* Inputs: (keyboard) */
/* 1. No. of hours worked during a week (integer) */
/* 2. Pay rate (dollars per week) (float) */
/* */
/* Output: */
/* weekly wages displayed on screen as float */
/* */
/* Algorithm: wages = hours worked * rate of pay */
/* */
/****************************************************/

#include <iostream>

using namespace std;

int main()
{
int hours_worked;
float pay_rate;
float wages;

do //here starts the repeat loop
{
//read in the hours worked
cout << endl ;
cout << "Number of hours worked during"
<< " the week (integer) = " ;
cin>> hours_worked;

// read in the pay rate
cout << "Weekly pay rate (specify two digits "
<< "after the decimal point) = " ;
cin>>pay_rate;

// compute wages
wages = hours_worked * pay_rate;

// display the result
cout << endl ;
cout << "The weekly wages are: $" << wages << endl ;

}while((hours_worked != -1) && (pay_rate != -1)); //loop ends here
return(0);
}

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Networking Questions

This quiz consists of some basic networking questions.

C# variables and classes

This quiz contains questions about C# classes and variables.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.