Problem Solving with C++ Plus MyLab Programming with Pearson eText -- Access Card Package (10th Edition)
10th Edition
ISBN: 9780134710747
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 7, Problem 12PP
Program Plan Intro
Program Plan:
- Include the appropriate headers into program.
- Declare the constant variables and functions.
- Declare the function prototypes.
- Define the “main()” function.
- Declare the variable “production[]” in type of integer.
- Print the value.
- Call the functions with appropriate arguments.
- Return statement.
- Define the function “graph()” with its arguments.
- Declare the appropriate variables.
- Declare the array variable in type of “char”.
- Using “for” loop, assign “*” and “ ” to array.
- Using “for” loops, print the values on screen.
- Define the function “scale()” with its arguments.
- Using “for” loop, call the “roundNum()” function to save value to array.
- Define the function “getTotal()” with its arguments.
- Prompt the value from user.
- Using “for” loop, add the values and store into “total” variable.
- Define the function “inputData()” with its arguments.
- Using “for” loop, get the “plantNumber” from user.
- Call the “getTotal()” function with arguments.
- Define the function “roundNum()” with its arguments.
- Return the rounded value.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a Java program that would resemble a power utility billing system. There will be an input window that would enter or input the meter number (5 numeric digits) and the present meter reading in kilowatt-hours, the maximum would be 9999 kilowatts. A search from a 2d-ArrayList would be made in order to get the previous meter reading of a particular meter number. The 2d- ArrayList consists of meter number (5 numeric digits) and the previous meter reading in kilowatt-hours (4 numeric digits with 9999 as a maximum value). Provide at least 5 sample data or 5 rows with meter numbers and previous meter reading for each row for the 2d-ArrayList. When an input of meter number and present meter reading is made, search the 2d-ArrayList for the equivalent meter number. If a match is found, get the kilowatt-hour used (KWH) by subtracting the previous meter reading from the present meter reading. Note that if the present meter reading is less than the previous meter reading, add 10000 first to…
Implement the"paint fill"function that one might see on many image editing programs. That is, given a screen (represented by a two-dimensional array of colors), a point, and a new color, fill in the surrounding area until the color changes from the original color.
Write a Java program that would resemble a payroll system. An input window which will accept the employee number and the number of days of rendered work. A 2d-arraylist that contains the employee number and the rate per day is to be searched and used to compute for the gross salary. Gross salary is computed by multiplying the number of days of rendered work by rate per day of the particular employee. If the gross salary computed is greater than 100,000 the tax is 20% of the gross salary, otherwise, the tax is 10%. Deduct the tax from the gross salary to get the net pay. Display the employee number, gross salary, tax deduction, and the net pay in an output window. Design your own input/output windows. ( USE OOP CONCEPT AND JOPTION)
Chapter 7 Solutions
Problem Solving with C++ Plus MyLab Programming with Pearson eText -- Access Card Package (10th Edition)
Ch. 7.1 - Prob. 1STECh. 7.1 - In the array declaration double score(5); state...Ch. 7.1 - Identity any errors in the following array...Ch. 7.1 - What is the output of the following code? char...Ch. 7.1 - What is the output of the following code? double a...Ch. 7.1 - What is the output of the following code? int i,...Ch. 7.1 - Prob. 7STECh. 7.1 - Suppose we expect the elements of the array a to...Ch. 7.1 - Prob. 9STECh. 7.1 - Suppose you have the following array declaration...
Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Prob. 12STECh. 7.2 - Write a function definition for a function called...Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Insert const before any of the following array...Ch. 7.2 - Write a function named outOfOrder that takes as...Ch. 7.3 - Write a program that will read up to ten...Ch. 7.3 - Write a program that will read up to ten letters...Ch. 7.3 - Following is the declaration for an alternative...Ch. 7.4 - Prob. 20STECh. 7.4 - Write code that will fill the array a (declared...Ch. 7.4 - Prob. 22STECh. 7 - Write a function named firstLast2 that takes as...Ch. 7 - Write a function named countNum2s that takes as...Ch. 7 - Write a function named swapFrontBack that takes as...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - There are three versions of this project. Version...Ch. 7 - Hexadecimal numerals are integers written in base...Ch. 7 - Solution to Programming Project 7.3 Write a...Ch. 7 - Prob. 4PPCh. 7 - Write a program that reads in a list of integers...Ch. 7 - Prob. 6PPCh. 7 - An array can be used to store large integers one...Ch. 7 - Write a program that will read a line of text and...Ch. 7 - Write a program to score five-card poker hands...Ch. 7 - Write a program that will allow two users to play...Ch. 7 - Write a program to assign passengers seats in an...Ch. 7 - Prob. 12PPCh. 7 - The mathematician John Horton Conway invented the...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - A common memory matching game played by young...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Prob. 19PPCh. 7 - The Social Security Administration maintains an...
Knowledge Booster
Similar questions
- Write a java while loop that loops through an array of type int with a size of 6, and adds up every other element in the array and prints the sum.arrow_forwardHow to write a program in java that can read numbers from a text file into an array then output these numbers 5 per line and display a ">" character next to each number that is greater than the average, then output a graph using "*" to show how many of each number there are? ex if the number 0 appears 5 time output 0 = ***** the text file is formated as show in screen shotarrow_forwardWrite a program in java in which we had an array and you have to find Whether this array is monotonic or notarrow_forward
- Write a Java Program that allows the user to enter an arbitrary number of integer grades from the keyboard. Each grade should be added to an ArrayList called grades. Stop inputting grades when -1 is entered. The program should then iterate through the ArrayList, calculate the average grade, and output it along with the minimum and the maximum grade value.arrow_forwardHow to write a program in java that can read numbers from a text file into an array, then output a graph using "*" to show how many of each number there are, formated as show below? 0=***** 1=** 2=*** 3=*** 4=********** 5=********* 6=*** 7=**** 8=******** 9=*** the text file is formated as showed in screen shotarrow_forwardJava In this assignment, you will practice using an ArrayList. Your class will support a sample program that demonstrates some of the kinds of operations a windowing system must perform. Instead of windows, you will be manipulating “tiles.” A tile consists of a position (specified by the upper-left corner x and y), a width, a height, and color. Positions and distances are specified in terms of pixels, with the upper-left corner being (0, 0) and the x and y coordinate increasing as you move left and down, respectively. You won’t have to understand a lot about tiles and coordinates. That code has been written for you. You are writing a small part of the overall system that keeps track of the list of tiles. You are required to implement this using an ArrayList. The only method you need to use from the Tile class is the following: // returns true if the given (x, y) point falls inside this tile public boolean inside(int x, int y) Your class is to be called TileList and must…arrow_forward
- 1. Write a program that would resemble a power utility billing system. There will be an input window that would enter or input the meter number (5 numeric digits) and the present meter reading in kilowatt hours, the maximum would be 9999 kilowatts. A search from a 2d-arraylist would be made in order to get the previous meter reading of a particular meter number. The 2d- arraylist consists of meter number (5 numeric digits) and the previous meter reading in kilowatt hours (4 numeric digits with 9999 as maximum value). Provide at least 5 sample data or 5 rows with meter number and previous meter reading each row for the 2d-arraylist. When an input of meter number and present meter reading is made, search the 2d-arraylist for the equivalent meter number. If a match is found, get the kilowatt hour used (KWH) by subtracting the previous meter reading from the present meter reading. Note that if the present meter reading is less than previous meter reading, add 10000 first to the present…arrow_forwardWrite a Java program to find continuous sub array of the given array whose sum is equal to a given number. For example, If {12, 5, 31, 9, 21, 8} is the given array and 45 is the given number, then you have to find continuous sub array in this array such that whose elements add up to 45. In this case, {5, 31, 9} is such sub array whose elements add up to 45.arrow_forwardWrite a Java program that accomplishes the same thing as the program in the pictures, except by using two dimensional arrays instead.arrow_forward
- How to write a program in java that can read numbers from a text file into an array then output these numbers 5 per line and display a ">" character next to each number that is greater than the average, then output a graph using "*" to show how many of each number there are? ex if the number 0 appears 5 time output 0 = ***** output should look like how it is written below Average is 4.78 5> 8> 8> 1 5> 0 6> 6> 5> 3 4 0 6> 8> 5> 4 9> 5> 8> 0 4 7> 4 2 0 9> 8> 3 5> 5> 5> 7> 5> 7> 1 4 4 0 7> 4 8> 4 2 4 9> 8> 8> 2 3 4 0=***** 1=** 2=*** 3=*** 4=********** 5=********* 6=*** 7=**** 8=******** 9=*** the text file is formated as showed in screen shotarrow_forwardThe implementation of a queue in an array, as given in this chapter, uses the variable count to determine whether the queue is empty or full. You can also use the variable count to return the number of elements in the queue. On the other hand, class linkedQueueType does not use such a variable to keep track of the number of elements in the queue. Redefine the class linkedQueueType by adding the variable count to keep track of the number of elements in the queue. Modify the definitions of the functions addQueue and deleteQueue as necessary. Add the function queueCount to return the number of elements in the queue. Also, write a program to test various operations of the class you defined.arrow_forwardSuppose we have two arrays, a and b, containing numbers of size n and m, respectively. a and b array; Write a program that collects the elements of a different from b in another array c in java language and determine the class it belongs to?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning