Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 9, Problem 5PP
Program Plan Intro
Computer Lab Logging
Program Plan:
- Include the necessary libraries.
- Use namespace.
- Define the constants and type definition.
- Define the function prototypes.
- Define the function “createArrays()” to create the dynamic array for the lab.
- Declare the variables.
- Define the first array which is the array of labs.
- Define the second array which defines the size of the lab.
- Define the function “freeArrays()” to release the allocated memory.
- Define the function “showLabs()” to display the status of all labs.
- Define the function “login()” to simulate the user login.
- Declare the required variables.
- Get input from the keyboard, validating data ranges.
- Use a while loop to repeat operation until user requires.
- Store the value and display the message.
- Finally, assign that station to the user.
- Define the function logoff() to logoff that user.
- Declare the required variables.
- Get input from keyboard, validating data ranges.
- Use a while loop to repeat operation until user requires.
- Store the value and display the message.
- Use a for loop to repeat operation until user requires.
- Display the message of the user logged in.
- Otherwise display that user is not logged in.
- Define the function “search()” to search that user.
- Declare the required variables.
- Get input from keyboard, validating data ranges.
- Use a while loop to repeat operation until user requires.
- Store the value and display the message.
- Use a for loop to repeat operation until the user is found out.
- Otherwise display that user is not logged in.
- Define the main method.
- Declare the variables that are required for program.
- Initialize lab sizes to those given in the problem.
- Create a ragged array structure.
- Use a while loop to repeat operation until user requires.
- Perform login, logoff or search function.
- Free memory before exiting.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Topic: Data Communication & Network
Write a socket server program named "RockPaperScissorsServer", which communicates with players (clients). Server firstly receives a name for the player. Let’s assume 1 is Rock, 2 is Paper and 3 is Scissors. Next Server receives any of the 3 number from the user, generate a random number between 1 to 3 itself and then apply the Rock Paper Scissors game logic (which is paper beats rock, rock beats scissors, scissors beats paper), Then it will tell the player if the player or server has won. Write another client program to communicate with the server.
Kindly make the server in such a way the any time any player can leave and another player can join.
Use Java to write the code.
*** Reference code: Creating a simple Server ***
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket;import java.util.Scanner;
public class Server1 {…
You have a group of friends coming to visit for your high school reunion, and you want to take them out to eat at a local restaurant. You are not sure if any of them have dietary restrictions, but your restaurant choices are as follows:
Joe’s Gourmet Burgers—Vegetarian: No, Vegan: No, Gluten-Free: No
Main Street Pizza Company—Vegetarian: Yes, Vegan: No, Gluten-Free: Yes
Corner Café—Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes
Write a program that asks whether any members of your party are vegetarian, vegan, or gluten-free, to which then displays only the restaurants to which you may take the group.
The task should be done in a group of max 3
In the program explained during the lab
the client sends only 1 message to server ‘hello from tcp client’
server responds with the uppercase message.
Update the program / make a simple chat program so that
Client can send/receive multiple messages to server.
A special exit message is used to disconnect ‘Exit’.
Each time client sends a message, server responds with a confirmation of receiving it and its length
(use the screenshots in the presentation as a reference)
Chapter 9 Solutions
Problem Solving with C++ (10th Edition)
Ch. 9.1 - Prob. 1STECh. 9.1 - Prob. 2STECh. 9.1 - Give at least two uses of the operator. State...Ch. 9.1 - Prob. 4STECh. 9.1 - Prob. 5STECh. 9.1 - Suppose a dynamic variable were created as...Ch. 9.1 - Write a definition for a type called NumberPtr...Ch. 9.1 - Prob. 8STECh. 9.2 - Write a type definition for pointer variables that...Ch. 9.2 - Suppose your program contains code to create a...
Ch. 9.2 - Prob. 11STECh. 9.2 - Prob. 12STECh. 9.2 - What is the output of the following code fragment?...Ch. 9.2 - What is the output of the following code fragment?...Ch. 9.2 - What is the output of the following code fragment?...Ch. 9 - Prob. 1PCh. 9 - Write a program that asks the user to input an...Ch. 9 - Palindrome testing with pointers This Practice...Ch. 9 - Do Programming Project 3 in Chapter 7 in this...Ch. 9 - Do Programming Project 11 in Chapter 7 using a...Ch. 9 - Write a function that takes a C string as an input...Ch. 9 - Prob. 5PPCh. 9 - One problem with dynamic arrays is that once the...Ch. 9 - Prob. 7PPCh. 9 - Write a program that outputs a histogram of...
Knowledge Booster
Similar questions
- Description: In this assignment, you'll write two clients (Agents) that will communicate with a server that you will also write. On start-up, the client should be prompted to enter their connection code. Your client (Agent) will then open a TCP socket to your server and send a message (a string of characters) to your server containing their <Connection Code>. The first five characters of the connection code is a predefined set, while the last four is the <Agent Code#!>. <Connection Code>=<Predefined Charterers> + <Agent Code#> Below are the list of the predefined characters and agent code numbers you should use in your project: Predefined Characters: [AJK78, KTV90, NEL55, DFG28] Agent Code Numbers: 1. Agent A-(2975) 2. Agent B-(6144) Possible Connection Codes for Agent B: 1. AJK786144 2. KTV906144 3. NELS56144 4. DFG286144 Anyone of these codes should successfully identify Agent B. If the connection code is unknow to the server, it should close the…arrow_forwardGiven that you have submitted many requests to a server, each with its own id (or unique identification) and priority (or priority).Requests = [(id1, p1), (id2, p2), ……, (idn, pn)], where p1 > p2 > …. > pn. Provide the best algorithm or pseudocode for dealing with all of the requests.arrow_forwardA tool is attached to link 3 of the manipulator. This tool is described by TTW, the tool frame relative to the wrist frame. Also, a user has described his work area, the station frame relative to the base of the robot, as TSB. Write the subroutine Procedure SOLVE(VAR trels: frame; VAR current, near, far: vec3; VAR sol: boolean); where “trels” is the {T} frame specified relative to the {S} frame. Other parameters are exactly as in the INVKIN subroutine. The definitions of {T} and {S} should be globally defined variables or constants. SOLVE should use calls to TMULT, TINVERT, and INVKIN.arrow_forward
- Consider the code below. Identify all statements that are true about the code. Select all that apply. protocol MessageSecurity { func encrypt(message: String) -> String func decrypt(message: String) -> String}struct SecureIsh : MessageSecurity { func encrypt(message: String) -> String { let split = message.components(separatedBy: " ") let ished = split.map({ $0 + "ish"}) return ished.joined(separator: " ") } func decrypt(message: String) -> String { let split = message.components(separatedBy: " ") let notIshed = split.map({ $0.dropLast(3)}) return notIshed.joined(separator: " ") }}struct SecureMessenger { var security: MessageSecurity mutating func assignSecurity(security: MessageSecurity) { self.security = security } func send(message: String, to: String) { // code for sending a message } func read(message: String, from: String) { // code for reading message }} Group…arrow_forwardPLEASE USE MULTITHREADING IN THIS PROGRAM SO THAT MANY CLIENTS CONNECTED TO THE SERVER AND EACH CLIENT CAN SEND MESSAGE TO SERVER AND SERVER MESSAGE SHOWN TO ALL CLIENTS AND ONE CLIENT MESSAGE SHOWN TO ALL CLIENTS.PLEASE MAKE CHANGINGS IN THIS CODE. SERVER #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/socket.h>#include <sys/types.h>#include <netinet/in.h>#include <arpa/inet.h>#include <pthread.h>#define PORT 5500 void func(int connfd){ char buffer[1024]; int n; while(1) { bzero(buffer, 1024); read(connfd, buffer, sizeof(buffer)); printf("From client: %s\t To client : ", buffer); bzero(buffer, 1024); n = 0; while ((buffer[n++] = getchar()) != '\n'); write(connfd, buffer, sizeof(buffer)); if (strncmp("exit", buffer, 4) == 0){ printf("Server Exit...\n"); break; } }}int main(){ int sockfd, connfd, len; struct…arrow_forwardWrite a server for a client. The client sends loan information (annualinterest rate, number of years, and loan amount) to the server (see Figure a).The server computes monthly payment and total payment, and sends them back tothe client (see Figure b). Name the client Exercise33_01Client and the serverExercise33_01Server.arrow_forward
- I need help with this: (BMI Server) Write a server for a client. The client sends the weight ( in pounds) and height (in inches) for a person to the server (see Figure 33.18a). The server computes BMI (Body Mass Index), and sends back to the client a string that reports the BMI (see Figure 33.18b). See Section 3.8 for computing BMI. Name the client Exercise33_01Client and the server Exercise33_01Server.arrow_forwardIn this programming assignment, you will implement the above ROS smart mobility system in city. create a service that the ROS service client node will send the GPS location of the autonomous vehicle. Consequently, the ROS service server will send back the current weather status by using c/c++arrow_forwardThis is sample data from my JSON file [ {"username" : "Jane Doe","date" : "Sat, 1 Apr 2023","time in" : "09:06:45 PM","status in" : "Working",}, {"username" : "Jane Doe","date" : "Sat, 1 Apr 2023","time out" : "09:06:57 PM","status out" : "Break" Please code a JAVA PROGRAM that will allow the server to determine if a user is currently working or on break by searching their name.arrow_forward
- A company is implementing tokenization as an alternative to protecting data without encryption. During this process, the application collects a piece of sensitive data. Which step should occur immediately after this action? A. Data is sent to the tokenization server. B. The tokenization server generates the token. C. The tokenization server returns the token to the application. D. Token data is stored by the application.arrow_forwardAfter executing the following code: LDI R16, 0xFF OUT DDRC, R16 LDI R16, 0x12 OUT PORTC, R16 SBI PORTC, 7 CBI PORTC, 1 What is the value of PORTC?arrow_forwardIn this programming assignment, you need to implement the above ROS smart mobility system in the city. You need to create a service that the ROS service client node will send the GPS location of the autonomous vehicle. Consequently, the ROS service server will send back the current weather status. Please, write the code(terminal included)/ C++.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage