SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
C++ Basics
Exercise:
Self-test Exercises
Question:7 | ISBN:9780321531346 | Edition: 7

Question

Give good variable names for each of the following:

      a. A variable to hold the speed of an automobile

      b. A variable to hold the pay rate for an hourly employee

      c. A variable to hold the highest score in an exam

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

a)

The  declared variable name is "autoSpeed" is used to hold the speed of an automobile:

//Declare variable name
autoSpeed

Example: 

//Initialized the variable name with data type double
double autoSpeed=60.5;

b)

The  declared variable name is "empPayHourRate" is used to hold the pay rate for an hourly employee:

//Declare variable name
empPayHourRate

Example: 

//Initialized the variable name with data type integer
int empPayHourRate=1000;

c)

 

The  declared variable name is "examHighScore" is used to hold the pay rate for an hourly employee:

//Declare variable name
examHighScore

Example: 

//Initialized the variable name with data type double
double examHighScore=95;
0 0

Discussions

Post the discussion to improve the above solution.