Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 10PP
Create a text file that contains the text "I hate C++ and hate
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Some word games require the player to find words that can be formed using the letters of another word. For example, given the word SWIMMING then other words that can be formed using the letters include SWIM, WIN, WING, SING, MIMING, etc. Write a c++ program that lets the user enter a word and then output all the words contained in the file words.txt (included on the website with this book) that can be formed from the letters of the entered word. One algorithm to do this is to compare the letter histograms for each word. Create an array that counts up the number of each letter in the entered word (e.g., one S, one W, two I, two M, etc.) and then creates a similar array for the current word read from the file. The two arrays can be compared to see if the word from the file could be created out of the letters from the entered word.
note: don't use chegg
Create a C++ hotel reservation program with a class that ask the user to enter a room number, the number of guests to occupy a room and also change the status of the room to reflect the number of guests that just checked in. Additionally, implement a loop asks the user if they want to search for a different room number. Display the information about the room in a nice format.
The output should look something like this:
Please enter the room number: 104
Please enter the number of guests: 10
Room number: 104
Guests in the room: 4
Room status: 4 occupants
Would you like to search for another room number ? Yes/No
Objective:Design and implement a word unscrambler game in Java.Details:Your program should read in a random word from a file called words.txt (note the lack of capitalization) that you provide. There should not be any hard limit on the number of words in the file. If words were added/removed from the file, your program should recognize such changes of the words.txt and handle appropriately next time it runs. The file should contain one word per line. To read a random word you can generate a random number between 1 and the number of lines, and skip n-1 lines before reading the word. Scramble the word by swapping random pairs of letters a random number of times. Display the scrambled word with character indexes on top. Assume that the word is always no more than ten characters (so that index can be within 0-9 range, inclusive).Offer the user a menu with the following choices:• Enter 1 to swap a pair of lettersIf this option is selected prompt the user to enter two indexes and swap the…
Chapter 2 Solutions
Absolute C++
Ch. 2 - It is difficult to make a budget that spans...Ch. 2 - You have just purchased a stereo system that cost...Ch. 2 - Suppose you can buy a chocolate bar from the...Ch. 2 - Write a program that finds and prints all of the...Ch. 2 - In cryptarithmetic puzzles, mathematical equations...Ch. 2 - Buoyancy is the ability of an object to float....Ch. 2 - Write a program that calculates the total grade...Ch. 2 - Write a program that finds the temperature, as an...Ch. 2 - (This is an extension of an exercise from Chapter...Ch. 2 - Create a text file that contains the text I hate...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Ackermarms Function Ackermanns function is a recursive mathematical algorithm that can be used to test how well...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
19.9 (Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a numbe...
C How to Program (8th Edition)
Why might doctors and nutritionists be interested in a device like DietSensor?
Using MIS (10th Edition)
Describe some design trade-offs between efficiency and safety in some language you know.
Concepts Of Programming Languages
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
- Write a C++ program: Make a class for rectangle which calculates perimeter and area. then write two programs(.cpp files). one program has two objects that each of them is a Square and you ask user to give you the side. and in other program you have two rectangle objects and you ask user to give you length and width. then by using the class you defind in seperate file, claculate area and primiter. in each program you have the following: use the dynamic allocation. has a default constructor has a destructor. use an array of objects for 2 different rectangles make a UML you have to upload 3 files as submissions for this assignment. (or you can submit a link to an online compiler such as "replit" that includes all these 3 files) class (.h) (just one) main function (.cpp) (two) UML (one)arrow_forwardCreate a C++ hotel reservation program with a class that ask the user to enter a room number, enter the daily rate, the number of guests to occupy a room and also change the status of the room to reflect the number of guests that just checked in. Additionally, implement a loop asks the user if they want to search for a different room number, if they enter 'yes' then it should allow them to start over and enter another different room numbwr. Display the information about the room in a nice format. The output should look something like this: Please enter the room number: 104 Please enter the number of guests: 10 Enter the daily rate: $150 Room number: 104 Guests in the room: 4 Room status: 4 occupants Daily rate: $300 Would you like to search for another room number ? Yes/Noarrow_forwardIn Java A comma separated value (.csv) file has been included to be used for this program. Each line contains two values, a name and a number separated by a comma (except the first line, which contains the titles for the value types). The name is that of a writer and the number refers to the number of works the writer has written. Ex. Jane Austen,6. Each line is an entry and each entry number can be updated by identifying the associated name. Once complete, the following program opens data file allWorks.csv and asks if the user wants to update entries or add new entries. All entries are stored in an array while being read in and updated. The program then writes the array to the file, overwriting the original contents. The following TODO sections must be completed. Open allWorks.csv for reading/input. Locate an entry to be updated by name (use the Java String indexOf() method) Add a new entry if the name isn't found in the file (give the entry a new number) Open file allWorks.csv for…arrow_forward
- In Java Suppose you are given a text file that contains the names of people. Every name inthe file consists of a first name and a last name. Unfortunately, the programmer thatcreated the file of names had a strange sense of humor and did not guarantee thateach name was on a single line of the file. Write a program that reads this file ofnames and writes them to the console, one name per line.For example, if the input file (Names.txt) contains:Bob Jones FredCharles EdMarstonJeffWilliamsThe output should be:Bob JonesFred CharlesEd MarstonJeff Williams Sample Output:Enter the name of the input file:Names.txtBob JonesFred CharlesEd MarstonJeff WilliamsFile processing completed.arrow_forwardA java file that reads a text file, in.txt, that contains a list of positive integers a positive integer) separated by spaces and/or line breaks. After reading the integers, the program must recursively figure out if the list of integers includes two equal integers. If the list includes two equal integers, the program prints out Yes. Otherwise, the program prints out No. Assume that in.txt contains at least 2 integers. It is important that your program be named Two and that the input file is named in.txt.arrow_forwardThe example of the two CSV files is attached below. One of the file is the crime database and the other one is the suspect database. Specification Your task is to write a python program that will take three CSV file names on the command line. The first CSV file contains STR counts for DNAs found in a list of crime scenes; the second CSV file contains a list of suspect's names and their DNA sequences; the third CSV file name is the output file where you write a CSV file that maps each suspect's name to the list of Crimes that have DNAs matching the suspect. Your program will take three file names on the command line: The first command line argument is a file name for a crime database file in csv file format. The header row would look like this:CrimeID,STR1,STR2,STR3,...Where each STRi is a short DNA sequence that is composed of DNA bases A/C/G/T. And each row will comprise of a CrimeID of the form CIDXXXXX, an integer count for each of the STRs. The second command line argument is a…arrow_forward
- Write a C# program that asks the user to enter a sentence, and then counts the number of words in the sentence. Your program should do the following: Ask the user to enter a sentence using the Console.ReadLine() method. Use the Split() method to split the sentence into words based on spaces. for example: // Split the sentence into words based on spaces string[] words = sentence.Split(' '); Count the number of words in the sentence using the Length property of the resulting array. Print a message to the console indicating the number of words in the sentence using the Console.WriteLine() method. Provide the code for your program (the .cs file). Example output: Enter a sentence: The quick brown fox jumps over the lazy dog. The sentence contains 9 words.arrow_forwardCreate a C++ game that would have an output that is given in the picture. First loop in the game needs to include: the user to choose a number between 1 and 100. and the user is only allowed 6 tries in the game. Second loop needs to ask the player if they want to play again answering with a character 'Y' or 'N'.arrow_forwardConsider a CSV file contains information about COVID-19 status of Bangladesh. The header of this file is "Date", "District", "Effected Today", and "Recover Today". Write a java program to find the minimum of the "Effected Today" and the maximum of "Recover Today" column from the file. Example: File contains: Output: Effected Today: 27 Recover Today: 195 18/6/2021, DHK, 345, 195 18/6/2021, BOG, 75, 28 18/6/2021, CHT, 231, 68 18/6/2021, KHL, 27, 17arrow_forward
- Python 3.7.4: Write a loop that reads strings from standard input, where the string is either "duck" or "goose". The loop terminates when "goose" is read in. After the loop, your code should print out the number of "duck" strings that were read. ----------------- This is what I tried so far, and it's been marked wrong by MyProgrammingLab: count = 0inputstring=input("Enter goose/duck: ")countducks=0while inputstring!="duck": countducks+=1 inputstring=input("Enter either the word goose or duck: ")print(countducks, "This is the number of times duck was entered:" count)arrow_forwardWrite a program that queries information from three files(given to you). The first file contains the names and telephone numbers of a group of people. The second file contains the names and Social Security numbers of a group of people. The third file contains the names and annual income of a group of people. The groups of people should overlap. Your program should ask the user for a telephone number and then print the name, Social Security number, and annual income, if it can determine that information. Sample run1: Enter the phone number (7 digits, with a dash): 555-1234 555-1234 is associated with Bob Bob's SSN is 000300021 Bob's salary is 55000 Sample run2: Enter the phone number (7 digits, with a dash): 675-4566 Couldn't find a name associated with that number. Sample run3: Enter the phone number (7 digits, with a dash): 000-2345 000-2345 is associated with John John's SSN is 000000004 John's salary is 65000 python languagearrow_forwardIn this assignment, you will create a Java program to search recursively for files in a directory.• The program must take two command line parameters. First parameter is the folder to search for. Thesecond parameter is the filename to look for, which may only be a partial name.• If incorrect number of parameters are given, your program should print an error message and show thecorrect format.• Your program must search recursively in the given directory for the files whose name contains the givenfilename. Once a match is found, your program should print the full path of the file, followed by a newline.• You can implement everything in the main class. You need define a recursive method such as:public static search(File sourceFolder, String filename)For each subfolder in sourceFolder, you recursively call the method to search.• A sample run of the program may look like this://The following command line example searches any file with “Assignment” in its name%java FuAssign7.FuAssignment7…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
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY