[solved] – Question 7015
Using loop
Write a C++ program that declares a secret word of 5 character and ask the user to find out that word . if the word entered by the user a character is in its correct position then it will appear , otherwise a star will be shown in its location. For example if the secret word is write and the user entered the word think then the program will display **i** . Then if the user enter the word arrive then the program will display *ri** ( the position of the character I was discovered in the pervious step) This process will continue till the user finds the correct word
Expert Answer
[solved] – Question 7017
Write a declaration statement to declare that the variable count will be used to store an integer.
b. Write a declaration statement to declare that the variable volt will be used to store a floating-point number.
c. Write a declaration statement to declare that the variable power will be used to store a double-precision number.
d. Write a declaration statement to declare that the variable keychar will be used to store a character.
4. (Practice) Write declaration statements for the following variables:
a. num1, num2, and num3 used to store integer number
b. amps1, amps2, amps3, and amps4 used to store double-precision numbers
c. volts1, volts2, and volts3 used to store double-precision numbers
d. codeA, codeB, codeC, codeD, and codeE used to store characters
5. (Practice) Write declaration statements for the following variables:
a. firstnum and secnum used to store integer
b. speed, acceleration, and distance used to store double-precision numbers
c. thrust used to store a double-precision number
6. (Modify) Rewrite each of these declaration statements as three separate declarations:
a. int month, day = 30, year;
b. double hours, volt, power = 15.62;
c. double price, amount, taxes;
d. char inKey, ch, choice = ‘f’;
7. (Desk Check) a. Determine what each statement causes to happen in the following program:
#include <iostream>
using namespace std;
int main()
{
int num1, num2, total;
num1 = 25;
num2 = 30;
total = num1 + num2;
cout << “The total of ” << num1 << ” and “
<< num2 << ” is ” << total << endl;
return 0;
}
b. What output will be printed when the program in Exercise 7a runs?
8. (Practice) What are the three items associated with every variable?
NNote for Exercises 9 to 11: Assume that a character requires 1 byte of storage, an integer requires
O T4 bytes, a single-precision number requires 4 bytes, and a double-precision number requires 8
Ebytes. Variables are assigned storage in the order they’re declared. (Review Section 1.6 if you’re
unfamiliar with the concept of a byte.) Refer to Figure 2.14 for these exercises.
Addresses
159 160161 162163164165166
167 168169 170171172173174
175 176177 178179180181182
183 184185 186187188189190
Figure 2.14 Memory bytes for Exercises 9 to 11
9. (Practice) a. Using Figure 2.14 and assuming the variable name rate is assigned to the byte at memory address 159, determine the addresses corresponding to each variable declared in the following statements. Also, fill in the correct number of bytes with the initialization data included in the declaration statements. (Use letters for the characters, not the computer codes that would actually be stored.)
float rate;
char ch1 = ‘M’, ch2 = ‘E’, ch3 = ‘L’, ch4 = ‘T’;
double taxes;
int num, count = 0;
b. Repeat Exercise 9a, but substitute the actual byte patterns that a computer using the ASCII code would use to store characters in the variables ch1, ch2, ch3, and ch4. (Hint: Use Appendix B.)
10. (Practice) a. Using Figure 2.14 and assuming the variable named cn1 is assigned to the byte at memory address 159, determine the addresses corresponding to each variable declared in the following statements. Also, fill in the correct number of bytes with the initialization data included in the declaration statements. (Use letters for the characters, not the computer codes that would actually be stored.)
char cn1 = ‘P’, cn2 = ‘E’, cn3 = ‘R’, cn4 = ‘F’, cn5 = ‘E’; char cn6 = ‘C’, cn7 = ‘T’, key = ”, sch = ”’, inc = ‘A’; char inc1 = ‘T’;
b. Repeat Exercise 10a, but substitute the actual byte patterns a computer using the ASCII
code would use to store characters in each of the declared variables. (Hint: Use Table 2.3.)
11. (Practice) Using Figure 2.14 and assuming the variable name miles is assigned to the byte at memory address 159, determine the addresses corresponding to each variable declared in the following statements:
float miles;
int count, num;
double dist, temp;
Expert Answer
[solved] – Question 70180
you will write a program that prompts the user for two integers and one of the 4 basic
mathematical operations. The only valid choices are: add, subtract, multiply, or divide (use true division and
not integer division). The user can type the operation using any combination of upper case and lower case
letters. If the user types in an operation that is not defined, the program should simply tell the user the
operation is not a valid operation (See sample run 1). Assuming the user’s operation is defined, you will
perform the operation, print the operands, print the operation (the way the user typed it), and the result. If the
second integer input is zero and the desired operation is division, don’t print the result, instead print that
“Division by zero is not allowed” (See sample run 2). After printing the result, display a line and print out any
of the three messages below that is true:
Both operands were negative
Both operands were positive
The result has three or more digits in it
Expert Answer
[solved] – Question 70190
#include<stdio.h>
int main()
{
int x=10;
printf(“n%d %d %d “,x,x++,++x);
return 0;
}
o/p is 12 11 12 in gcc
12 11 11 in windows
HOw is it ???
Expert Answer
[solved] – Question 70215
Exercise 71109 Write a class named Employee that has the following fields:
name: The name field is a String object that holds the employee’s name.
idNumber: The idNumber is an int variable that holds the employee’s ID number.
department: The department is a String object that holds the name of the name of the department where the employee works.
position: the position field is a String object that holds the employee’s job title.
Write appropriate mutator methods that store the values in these fields and accessor methods that return the values in the field.
Once you have written the class add a main method that creates three Employee objects to hold the following data:
Name ID Number Department Position
Susan Meyers 47899 Marketing Sales Rep
Mark Jones 39119 IT Programmer
Joy Rogers 81774 Manufacturing Engineer
The program should store this in the three objects and then display the data for each employee in the format:
Expert Answer
[solved] – Question 70240
Create a program that input a grade from the user. The grade input from the user will be an integer. Once the
input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do
not use if statements by itself or another strategy to solve this problem. You will print and “Error” for inputs
greater than 100. You will also print an “Error” for inputs less than 0. Both errors must be handled together
by a compound conditional statement that is joined by a short circuit &&. The error should not be a print
statement. It should use a String variable that is assigned the value of ERROR. You must a Char variable for
each letter grade. You must use a System.out.println for printing the error. You must a System.out.printf for
printing the letter grade.
You will run the program three times. Each time you run the program you will enter three different inputs.
1. 140
2. -42
3. 85
Expert Answer
[solved] – Question 70259
The simple interest on a loan is calculated by the formula:
interest = principal * rate * days / 365;
The preceding formula assumes that rate is the annual interest rate, and therefore includes the division by 365 (days). Develop a pseudo code program that will input principal, rate and days for several loans, and will calculate and display the simple interest for each loan, using the preceding formula and also draw flow chart of your program. Here is a sample input/output dialog:
Enter loan principal (-1 to end): 1000.00
Enter interest rate: .1
Enter term of the loan in days: 365
The interest charge is $100.00
Enter loan principal (-1 to end): 1000.00
Enter interest rate: .08375
Enter term of the loan in days: 224
The interest charge is $51.40
Enter loan principal (-1 to end): -1
Expert Answer
[solved] – Question 7028
Hi!
you can help me this software:
This software would assist the users to store and retrieve personal information. According to the requirement specifications, the software should provide the functionality to store contact details of various people. It should also enable the user to store the details of meetings and appointments. In addition, the software should display reminders to alert the user for meetings and appointments.
Design specifications
When the application is executed, a menu with the following options should be displayd:
Contact details
Meetings/appointment
On selecting either of the preceding options, a submenu with the following options should be displayed:
Add new record
Delete record
Edit record
Search record
The contact details option would enable the user to add, edit, delete, and search the contact details of various people. the contact include information such as name, address, phone number, and email adress.
Similarly, the Meetings/appointments options enable the user to ad
Expert Answer
[solved] – Question 70281
you will write a program that will store sentences in a list and get practice with working with lists
and strings. First, ask how many sentences the user wants to store. You can assume that you will get an
integer, but if it is non-positive, default to the value of 5. Next, get the user input (i.e. the sentences) and
store them in your list in all lower-case letters. You can assume that the user will enter sentences without
the . at the end.
Next, you will loop the same number of times as the number of sentences in your list and in each iteration
you will display the following menu:
print (“Enter 1 to see a sentence”)
print (“Enter 2 to see the whole list”)
print (“Enter 3 to change a sentence”)
print (“Enter 4 to switch words”)
print (“Enter 5 to count letters”)
You can assume that the user will enter an integer. Below is what you should do depending on the choice.
Expert Answer
[solved] – Question 70283
Write a program that accepts two real numbers and a select code from a user. If the entered select code is 1, have the
program add the two previously entered numbers and display the result; if the select code is 2, the numbers should be
multiplied; and if the select code is 3, the first number should be divided by the second number.
Expert Answer

