Concept explainers
This project is the same as
const int ANSWERS = 8; |
This way you can change the answer file so that it contains more or fewer answers and you need change only the constant declaration to make your program work correctly for a different number of possible answers. Assume that the answer listed first in the file will always be the following, even if the answer file is changed:
I'm not sure, but I think you will find the answer in Chapter #N. |
When replacing the two characters #N with a number, use the number (count % NUMBER_OF_CHAPTERS + 1), where count is the variable discussed above, and NUMBER_OF_CHAPTERS is a global named constant defined to be equal to the number of chapters in this book.
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Starting Out With Visual Basic (7th Edition)
Database Concepts (7th Edition)
Software Engineering (10th Edition)
- In C Programming Language Palindrome: “A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward, such as ‘madam’ or ‘kayak’” (excerpt from Wikipedia).Write a program that reads 8 words from Palindrome.txt and checks whether the word you read is a palindrome (please read its description above) or not. Print the index numbers of all the palindrome words in your array. You are required to read words character by character into a character array.• Write readFile function, which gets a file pointer and a two-dim array, to read each word(bunch of characters) line by line and store them into a two-dim character array.• Write findSize function takes a one-dim array and returns its actual size.• Write isPalindrome function takes a one-dim character array to check whether the content is a polindrome or not. If the word (character squence) is a palindrome, then it returns 1. Otherwise, it returns 0.arrow_forwardJAVA PPROGRAM ASAP Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram. Chapter 9. PC #10. Word Counter (page 610) Write a program that asks the user for the name of a file. The program should display the number of words that the file contains. Input…arrow_forwardYou have been asked to develop the new system. You are to write an application to assign seats in an airline. Assume a small airplane with 28 seats (7 rows 4 wide) as follows: 1 A B C D 2 A B C D 3 A B C D 4 A B C D 5 A B C D 6 A B C D 7 A B CD The program should display the seat pattern, with an X marking the seats already assigned. 1 X B C D 2 A X C D 3 A B C D 4 A B X D 5 A B C D 6 A B C D 7 A B C D The program then requests a choice of seat. If the seat if available,then the seating display is updated. Otherwise, the program requests another choice of seat. If the user types in a seat that is already assigned, the program should say that that seat is occupied and ask for another choice. This continues until all seats are filled or until the user says that the program should end.arrow_forward
- A Fibonacci Number sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is calculated by adding up the two numbers before it. Write a program called fib.cpp. The program will print out the n" Fibonacci Numbers using a function called: void FibonacciNumber (int n, int& fib_no) This function will calculate the n term in the Fibonacci Numbers and return in fib_no. By definition, the function returns 0 for n=1, and returns 1 for n = 2. For the subsequence number: nth = (n - 2)th + (n - 1)th You need to verify the input n > 0. Task 2 Sample Output Please enter the nth term Fibonacci number to compute: -1 Please enter a number greater than 0! Please enter the nth term Fibonacci number to compute: 12 The Fibonacci series is: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 The 12th. term is: 89arrow_forwardin java pls: You have been asked to produce a report for a hardware store The name for each item is widget with the word designating the number of the widget. There are ten widgets in all. Your program will ask the user for the range of the cost for items, range of the price of the items in doubles. The range for the quantity in stock will be between 0 and 9999 as an int. Your program will randomly generate the cost of the items, price of the items the number in stock for this sample report based upon the ranges entered. Make sure the price of the item is greater than the cost. Profit is calculated as (price- cost) * in stock. Any time quantity falls below 25 the reorder column will display Yes, otherwise it will display No. Your chart will generate data for ten items and the chart will look like the one below. Part QuantityName Cost Price in Stock…arrow_forwardin C++ here is my code that will ask to answer the multiplication fo teo random numbers when the user enter the right answer, it says very good then it keeps asking the next random set of numbers multiplication answer, till the user answer incorrectly, it says please try again then it exists, i want the program not to exit but to say please try again till the user puts the right answer then it says very good and does to the next question ...etc... can you implemnt what i just asked ? and thank you code: #include<iostream>// to be able to use input output stream#include<math.h>//h is a header file in the standard library of the C programming language designed for basic mathematical operations#include<cstdlib>//Converts a string into a long integer, also carry the library for definition of memory allocation and random processe#include<ctime>//converts the given time since epoch to a calendar local time and then to a character representation.using namespace…arrow_forward
- A business that uses functions to calculate the weekly payment amounts of employees in a workplace.you are asked to write a program.The weekly payment amount of an employee depends on the following variables:- Number of hours worked - (minimum: 0, maximum: 60)- Hourly wage - (minimum: 0.00 TL, maximum: 30.00 TL)- Number of exemptions - (minimum: 0, maximum: 5)Using these 3 values,- Gross payment amount- General income taxLocal income tax- Social security amount- Net payment amountwill be calculated. →The maximum number of hours an employee can work before earning overtime pay is 40 hour. If the number of hours worked is less than or equal to 40, the gross payment amount will be equals the product of the wage. If the number of hours worked is more than 40, the gross payment amount is 40 times the hourly wage. plus 1.5 times the hourly rate for every hour over 40 →The general withholding tax is 55.77 TL for the weekly payment period. The employee is subject to general taxation the gross…arrow_forwardSometimes data is not always in the format we need it to be in. In this hypothetical situation, you are writing a program to load phone numbers into a database from user entered survey data. The 10 digit phone number will be stored in the database as an integer (e.g. 1234567890), however the user may enter the phone number in any format (e.g. 123-456-7890). You will write a program that creates a new string from the user entered number consisting of only the digits so it should have the same structure as word_quiz.py in the Unit 5 lecture slides. Below are two examples of how your program should run with different inputs: Enter phone number: (530) 555-1212 Numbers: 5305551212 Enter phone number: 916-123-4567 Numbers: 9161234567 The last line of your program should be: print("Numbers:", phoneNum)arrow_forwardIn Java code Write a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.arrow_forward
- Python Programming Questionarrow_forwardIn C# language using Microsoft Visual Studio in Windows Forms App (.NET Framework) A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. Create an application that simulates a slot machine. The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols.arrow_forwardTrainers at Tom's Athletic Club are encouraged to enroll new members. Write an application that extracts the names of Trainers and groups them based on the number of new members each trainer has enrolled this year. Output is the number of trainers who have enrolled 0 to 5 members, 6 to 12 members, 13 to 20 members, and more than 20 members. Give their names as well as the number of members they have enrolled. Use this list of trainers: {"Jake Butt", "Ziggy Hood", "Hroniss Grasu", "Vontaze Burfict", "Jaquiski Tartt","Ndamukong Suh", "Thurston Armbrister", "Captain Munnerlyn", "Barkevious Mingo", "Ha Ha Clinton-Dix","Mister Alexander", "BenJarvus Green-Ellis", "Richie Incognito", "Champ Bailey", "Captain Munnerlyn","Mike Kafka", "Ras-I Dowling", "Bryan Anger", "D'Brickashaw Ferguson", "Rex Hadnot","Sage Rosenfels", "Robert Griffin III", "Sav Rocca", "Chad Ochocinco", "Brett Rypien"} Use this list of the number of members each trainer has enrolled: {3, 9, 13, 26, 23,19, 15, 13, 17,…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,