
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write the full C++ code for the expected output provided in the second screenshot

Transcribed Image Text:The main function,
1. Prompts the user to enter a capacity, and then declares a pointer groups pointing to a dynamic array of Student with the entered capacity.
2. Prompts the user to enter a student's id and name. If the entered id is not 0, creates a Student object newStudent with the entered id and name values.
3. Adds the object newStudent in the dynamic array groups. You may declare an int variable size to count the number of student objects stored in the dynamic array.
4. Repeats the step 2 and 3 until the entered student id is O.
5. Displays the student information in groups, that is, print out the student id and name in the dynamic array.
The expected result:
Enter the capacity of dynamic array (int): 20
Enter the student id (int) and name (string): 1101 Taylor
Enter the student id (int) and name (string): 1102 Smith
Enter the student id (int) and name (string): 1103 Alice
Enter the student id (int) and name (string): 1104 Tom
Enter the student id (int) and name (string): 0 noname
The students are:
1101 Taylor
1102 Smith
1103 Alice
1104 Tom

Transcribed Image Text:Lab Exercise
Write C++ programs that
•
Implement the class Student in the file Student.cpp
#ifndef STUDENT_H
#define STUDENT_H
#include <string>
#include <iostream>
class Student
{
public:
// Default constructor
Student():id(0), name("")
{
}
// Creates a student with the specified id and name.
Student(int idvalue, const string & namevalue)
{
}
// Returns the student name.
string get_name() const
{
}
// Returns the student id.
int get_id () const
{
}
// Sets the student name.
void set_name(const string& namevalue)
{
}
// Sets the student id.
void set_id(int idvalue)
}
// Prints the student id and name.
void print_student () const
{
cout << id <<
"
<<name <<endl;
}
private:
};
// student name
string name;
// student id
int id;
#endif
The test program lab02.cpp contains the main function.
#include "Student.cpp'
int main()
{
"
// Declare variables
int capacity = 0, size = 0, id =0;
string name;
cout<<"Enter the capacity: ";
cin>> capacity;
// Add your code ...
return 0;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- Hi, I wanted to ask if I can get some help in C++ 2.Write a nested loop to print the following for any n x n image of odd dimensions: Example Output (if n==5): X 0 0 0 X X 0 0 0 X 0 0 0 0 0 X 0 0 0 X X 0 0 0 X Example Output (if n==3): X 0 X 0 0 0 X 0 Xarrow_forwardHi, I have posted this question before but the solution am getting is not what I want. Note: Please follow the instructions I posted before the question, let me know if there is an issue. Instruction: Please write these problems in javascript. 1. You are to have two javascript files: a. your problem javascript and b. your test javascript file that verifies the function that was written in your problem javascript 2. The implementation for your 5 JavaScript functions must be completed within your - problems.js file. 3. Your Problem JavaScript functions file must be configured for strict mode (“use strict”) The pages that follow provide the description of the 5 JavaScript functions that you must implement Questions 1. Description a). You are to develop a JavaScript file (problems.js) that contains the implementation of 5functions. Each function is represented as one step, b). Each function is independent and solves a unique problem, as such, treat and implement each function in…arrow_forwardHELP WITH PYTHON Define the function, progVersion(p) with a loop to print “Python 3.10” p times to the console.arrow_forward
- The Python print function supports other keyword parameters besidesend. One of these other keyword parameters is sep. What do you thinkthe sep parameter does? Hint: sep is short for separator. Test your ideaeither by trying it interactively or by consulting the Python documentation.arrow_forwardI'm doing a video and audio editing in python. Trying to convert an srt file to audio with timings. That's why I'm trying to do so that the talking parts are as long as the timings in the srt file. If they are not, I want to either speed up or speed down the parts. Here's what I have so far, the else part works perfectly fine but I can't seem to get the if part working. Why? duration_of_dialogue = str(sub.end - sub.start) time_datetime = datetime.strptime(duration_of_dialogue, "%H:%M:%S,%f") milliseconds2 = (time_datetime.hour * 3600 + time_datetime.minute * 60 + time_datetime.second) * 1000 + time_datetime.microsecond / 1000 print("Duration should be ", milliseconds2) text_duration_ms = len(audio_segment) print("Current duration is ", text_duration_ms) if text_duration_ms != milliseconds2: speed_change = milliseconds2 / text_duration_ms if speed_change > 1: audio_segment = audio_segment.speedup(speed_change) else: audio_segment =…arrow_forwardThe answer needs both a C++ and a Python code and the source code for the C++ is a picture attached Design a menu with appropriate user interactions and checks for valid entry. Use C++ to successfully complete this criterion. Your simple program will need a menu that can validate user input and is easy to use. It needs to include options for the display of a multiplication table, doubling a value, and exiting the program. If either of the first two options are selected, then users need to be prompted to input a numeric value. The menu should be displayed using a loop, where the user can choose to exit the program only by selecting option 3. Any user input other than 1, 2, or 3 should result in an error message that returns the user to the menu. An example menu might look like the following:1: Display a Multiplication Table 2: Double a Value 3: Exit Enter your selection as a number 1, 2, or 3. Create code that prints a multiplication table for a given numeric value. Both C++ and…arrow_forward
- I am learning C++ and would like to make cleaner code. I am learning on Udemy.com how having the main at the bottom of the program helps when making blocks of code. What I would like to do is take some code I already have, and have the user enter two prime colors to make a mixed color, then ask the user if they would like to mix another color with two of the same prime and one other prime color to get: yellow-green, yellow-orange, orange-red, red-purple, blue-green, and blue-purple. Is my logic flawed? What is the correct logic? How would I set up this code to have different functions outside the main with the main at the bottom? I know it is supposed to read the information first somehow. I just can't process how to write it. #include <iostream>#include <string> using namespace std; int main() { string arr[] = {"red", "blue", "yellow"}; int color1, color2; string mixedColor; char choice; do { cout << "Enter one prime color followed by a second…arrow_forward7. Make a circuit with a blinking LED and a button. The button makes the LED blink faster when pressed. Use only Ardunio C++ Code!arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education