Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 5, Problem 46RQE
Program Plan Intro
Program description to print the string in reverse order using “for” loop is as follows:
- Include required header files.
- Define the function “main ()”. Inside this function,
- Declare and initialize the string.
- Loop from length of the string through 0.
- Print the character.
- Return 0.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Instructions for Questions 1 through 6. For each piece of pseudocode, give the
runtime in terms of N. Your answer should give an exact value for the number of times
the inner loop runs (i.e. the final value of count), and it should also give the order of
growth of the runtimes using big-Oh notation. You can assume that N "comes out nicely"
with respect to loops. For example, if the loop counts by 2, you can assume it is an even
number, and if it multiplies or divides by 2 each time, you can assume it is a power of 2.
Note: log(N!) is 0(NlogN).
Using Java, solve the assignment attached in the image.
Mailings
Review
View
ell me what you want t
Help
Design
Layout
References
imes New Romar -
12
A A
Aa v
ab
、三
B
IU abs X, x A
Paragraph
Font
Objective(s):
You are required to write a program in JAVA based on the problem description given. Read the
problem description and examine the sample of output; then study the program design given.
Using the problem-solving tips as a guide, write a complete program with necessary useful
comment for good documentation. Compile and execute the program.
Learning Outcome(s):
1. To introduce business problem specification/requirement and translates into JAVA codes.
2. To practice writing simple application of deploying object-oriented programming concept using
JAVA.
DESCRIPTION OF PROBLEM:
Write a program contained a class Student which has firstName, lastName, mark, grade. The
class allows object instance to assign firstName, lastName and mark from input user and
perform and assign grade based on mark's criteria displayed below.
SAMPLE OF OUTPUT:
Enter…
Chapter 5 Solutions
Starting Out with C++: Early Objects
Ch. 5.1 - How many lines will each of the following while...Ch. 5.1 - Prob. 5.2CPCh. 5.3 - What will each of the following program segments...Ch. 5.5 - Prob. 5.4CPCh. 5.5 - Write a program segment with a do-while loop that...Ch. 5.5 - Revise your answer to Question 5.8 to use the...Ch. 5.6 - What three expressions appear inside the...Ch. 5.6 - You want to write a for loop that displays I love...Ch. 5.6 - Prob. 5.9CPCh. 5.6 - Write a for loop that displays your name 10 times.
Ch. 5.6 - Write a for loop that displays all of the odd...Ch. 5.6 - Write a for loop that displays every fifth number,...Ch. 5.8 - Prob. 5.13CPCh. 5.8 - Write a for loop that sums up the squares of the...Ch. 5.8 - Write a for loop that sums up the squares of the...Ch. 5.8 - Write a for loop that repeats seven times, asking...Ch. 5.8 - Write a for loop that calculates the total of the...Ch. 5.8 - Prob. 5.18CPCh. 5.8 - Write a sentinel-controlled while loop that...Ch. 5.11 - Which loop (while, do-while, or for) is best to...Ch. 5.11 - How many total stars will be displayed by each of...Ch. 5.11 - What will the following program segment display?...Ch. 5.12 - Prob. 5.23CPCh. 5.12 - What header file must be included in a program to...Ch. 5.12 - What five steps must be taken when a file is used...Ch. 5.12 - What is the difference between a text file and a...Ch. 5.12 - Prob. 5.27CPCh. 5.12 - What type of file stream object do you create if...Ch. 5.12 - What type of file stream object do you create if...Ch. 5.12 - Prob. 5.30CPCh. 5.12 - Assume you have an output file named numbers.txt...Ch. 5 - To _______ a value means to increase it by one.Ch. 5 - To _______ a value means to decrease it by one.Ch. 5 - Prob. 3RQECh. 5 - Prob. 4RQECh. 5 - The statement or block that is repeated is known...Ch. 5 - Each repetition of a loop is known as a(n)...Ch. 5 - A loop that evaluates its test expression before...Ch. 5 - A loop that evaluates its test expression after...Ch. 5 - A loop that does not have a way of stopping is...Ch. 5 - A(n) ______ is a variable that counts the number...Ch. 5 - Prob. 11RQECh. 5 - A(n) ________ is a variable that is initialized to...Ch. 5 - A(n) ______ is a special value that marks the end...Ch. 5 - The ________ loop is ideal for situations that...Ch. 5 - The _____ loop always iterates at least once.Ch. 5 - The _______and ______ loops will not iterate at...Ch. 5 - Inside the for loops parentheses, the first...Ch. 5 - A loop that is inside another is called a(n)...Ch. 5 - The _________ statement causes a loop to terminate...Ch. 5 - The _____ statement causes a loop to skip the...Ch. 5 - What header file do you need to include in a...Ch. 5 - What data type do you use when you want to create...Ch. 5 - What happens if you open an output file and the...Ch. 5 - What data type do you use when you want to create...Ch. 5 - What is a files read position? Where is the read...Ch. 5 - What should a program do when it is finished using...Ch. 5 - Write code that lets the user enter a number. The...Ch. 5 - Write a do-while loop that asks the user to enter...Ch. 5 - Write a for loop that displays the following set...Ch. 5 - Write a loop that asks the user to enter a number....Ch. 5 - Write a nested loop that displays the following...Ch. 5 - Write a nested loop that displays 10 rows of #...Ch. 5 - Rewrite the following code, converting the while...Ch. 5 - Rewrite the following code, replacing the do-while...Ch. 5 - Convert the following whi1e loop to a for loop:...Ch. 5 - Convert the following for loop to a while loop:...Ch. 5 - Prob. 37RQECh. 5 - Prob. 38RQECh. 5 - What will each of the following program segments...Ch. 5 - int x = 1 ; while (x 10) x++; cout x;Ch. 5 - Prob. 41RQECh. 5 - Prob. 42RQECh. 5 - Each of the program segments in this section has...Ch. 5 - A) // This code should use a loop to raise a...Ch. 5 - A) // This code should display the sum of two...Ch. 5 - Prob. 46RQECh. 5 - Characters for the ASCII Codes Write a program...Ch. 5 - Sum of Numbers Write a program that asks the user...Ch. 5 - Distance Traveled The distance a vehicle travels...Ch. 5 - Celsius to Fahrenheit Table In one of the Chapter...Ch. 5 - Prob. 5PCCh. 5 - Ocean Levels Assuming the level of the Earths...Ch. 5 - Pennies for Pay Write a program that calculates...Ch. 5 - Prob. 8PCCh. 5 - Prob. 9PCCh. 5 - Random Number Guessing Game Write a program that...Ch. 5 - Random Number Guessing Game Enhancement Enhance...Ch. 5 - The Greatest and Least of These Write a program...Ch. 5 - Prob. 13PCCh. 5 - Prob. 14PCCh. 5 - Population Write a program that will predict the...Ch. 5 - Math Tutor Version 3 This program started in...Ch. 5 - Hotel Suites Occupancy Write a program that...Ch. 5 - Rectangle Display Write a program that asks the...Ch. 5 - Diamond Display Write a program that uses nested...Ch. 5 - Triangle Display Write a program that uses nested...Ch. 5 - Arrowhead Display Write a program that uses nested...Ch. 5 - Sales Bar Chart Write a program that asks the user...Ch. 5 - Savings Account Balance Write a program that...Ch. 5 - Using FilesTotal and Average Rainfall Write a...Ch. 5 - Using FilesPopulation Bar Chart Write a program...Ch. 5 - Using FilesStudent Line Up Modify the Student...Ch. 5 - Using FilesSavings Account Balance Modification...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please explain the stepsarrow_forwardIN C PROGRAMMING LANGUAGE A resistor is a circuit device designed to have a specific resistance value between its ends. Resistance values are expressed in ohms (Ω) or kilo-ohms (kΩ). Resistors are frequently marked with colored bands that encode their resistance values, as shown in the Figure. The first two bands are digits, and the third is a power-of-ten multiplier. The Table below shows the meanings of each band color. For example, if the first band is green, the second is black, and the third is orange, the resistor has a value of 50 × 103 Ω or 50 k Ω. The information in the Table can be stored in a C program as an array of strings. char COLOR_CODES[10][7] = {"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "gray", "white"}; Notice that “red” is COLOR_CODES[2] and has a digit value of 2 and a multiplier value of 102. In general, COLOR_CODES[n] has digit value n and multiplier value 10n. Write a program that prompts for the colors…arrow_forwardTry to design a game in which the user has to guess a number and If it is in 100 to 125 then you have to show that his guess is right else print wrong guess in Java programming language.arrow_forward
- (Simulation) Write a program to simulate the roll of two dice. If the total of the two dice is 7 or 11, you win; otherwise, you lose. Embellish this program as much as you like, with betting, different odds, different combinations for win or lose, stopping play when you have no money left or reach the house limit, displaying the dice, and so forth. (Hint: Calculate the dots showing on each die with the expression dots=(int)(6.0randomnumber+1), where the random number is between 0 and 1.)arrow_forwardprogramming for business field in python write a program to find the depreciation value of an asset (property) by reading the purchase value of the asset (amt), year of the service (year) and the value of the depreciationarrow_forwardThe method of top-down design is to break a problem into sub-problems and then solve the original problem by solving each sub-problem. a. Trueb. Falsearrow_forward
- Write a C# program that plays a guessing game with the user. Your program should select a random number between 1 and 50 and then let the user try to guess it. The program should continue asking the user for a number until he guesses correctly. (See below for some tips on random numbers). CHALLENGE #1: Modify your program so that it only allows the user 10 guesses, and then declares them to be an inadequate guesser if they haven’t gotten it correct. Your program should output the random number chosen. CHALLENGE #2: Modify your program so that after they guess a number (or get declared inadequate, if you do Challenge #1) that it asks them if they want to play again, and responds accordingly. Some Random Number Generation HintsRandom rndNumber = new Random();Console.WriteLine(rndNumber.Next()); //random integerConsole.WriteLine(rndNumber.Next(101)); //random integer between 0 and 100Console.WriteLine(rndNumber.Next(10, 43)); //random integer between 10 and…arrow_forwardPlease do this in Python Programming Scenario As you probably know, Sudoku is a number-placing puzzle played on a 9x9 board. The player has to fill the board in a very specific way: each row of the board must contain all digits from 0 to 9 (the order doesn't matter) each column of the board must contain all digits from 0 to 9 (again, the order doesn't matter) each of the nine 3x3 "tiles" (we will name them "sub-squares") of the table must contain all digits from 0 to 9. If you need more details, you can find them here. Your task is to write a program which: reads 9 rows of the Sudoku, each containing 9 digits (check carefully if the data entered are valid) outputs Yes if the Sudoku is valid, and No otherwise. Test your code using the data we've provided. Test data Sample input: 295743861 431865927 876192543 387459216 612387495 549216738 763524189 928671354 154938672 Sample output: Yes Sample input: 195743862 431865927 876192543 387459216 612387495 549216738 763524189 928671354…arrow_forwardIn programming language C.Write an algorithm to input a number. Find its square if the entered number is multiple of 10. If entered number if not a multiple of 10, then find its cube.arrow_forward
- According to the given question, here is the solution Write a program in Python that asks the user for a series of numbers. The program starts by asking the user for the size of this series then prompts the user to enter the numbers. When all numbers have been taken, the program displays: • The numbers are sorted. • The average • The median • The smallest number. • The largest number. Demonstrate in UML diagram and flowchart diagram?arrow_forwardNote: write a Jave Progame below Question2: Suppose a retail business sells an item that is regularly priced at $98 and is planning to have a sale where the item s price will he reduced by 25 percent. You have been asked to write a program to calculate the sale price of the item. To determine the sale price you perform two calculations: you get the amount of the discount, which is 25 percent of the item's regular price. you subtract the discount amount from the item's regular price. This gives you the sale price.arrow_forwardYou should write a C-program to create a fixed maze of size 25 × 40 and place the @ symbol atthe entrance of the maze as shown in diagram below: 2. You should define four keys on the keyboard for moving in the left/right/up and down directionsso that you can move the @ character in order to find your way through the maze till the exitpoint,3. The program should time how long it takes for a player to reach the exit point and should comparethis value to the previous scores which may exist in a text file and inform the player how manypeople who have played before has done better than him/her. Last player’ score should also beappended to the existing scores of the earlier players that are already in the text file.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT