Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help its due today!! 2nd time I post this. can you make a program that asks the user to enter their given information as

Please help its due today!! 2nd time I post this.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
can you make a program that asks the user to enter their given information as shown above !?? c++
A Heap of students (A6) Due Friday by 11:59pm Points 100 Overview The purpose of this lab is to give you a deeper understanding of memory management by forcing you to utilize the standard C++ heap structure as much as possible. Build a normalized student record system. Create a class to represent student data. You will also create classes to handle other specific types of data including dates and addresses. Your system will include all the necessary header files, cpp files, Makefile, and a main program to incorporate the larger system. Details . Imagine a university wants to keep track of the following data about each student: First name . Last name address line 1 address line 2 & city ment . state zip code date of birth month date of birth day date of birth year anticipated completion month anticipated completion day anticipated completion year Spa credit hours completed It is obvious that we will need a student class to contain all this data. However, the principles of data design indicate that the address should be its own class, as should the date. Your program should then have at least three classes: address, date, and student. Student will have two instances of date and one of address among its data members. . Process Build all the classes you will need for this project. Each class should have a separate header file. This file contains only the class definition. Ensure your headers use the #ifndef structure described in lecture, and include whatever other headers they need. Build a cpp file for each class which contains the code implementation of the class. This code file will include the class header file and any other headers and libraries needed. Build a main program that imports all the needed classes and tests them. You'll then modify this program. Create a makefile to control the compilation process. The instructor will test the program by running the make utility, 50 be sure your makefile works. If you use a visual editor like code:blocks, you'll still need to create and test a makefile for your project. Note IDE's have tools to build make files automatically, but they are often terrible. Make your own. It's must include to include clean and run builds in your makefile along with a command to run Valgrind. Look at Andy's example for guidance on how to create it, but the command should be called valgrind. Use git to manage your versions. There is no way you can prove you used git, but learn how to use it now. It's ideal for a larger project like this with multiple files All instances of your classes should be stored separately on the heap. That is to say, all should make use of the new keyword. Your program will be tested using the Valgrind tool to ensure you have responsibly deallocated memory when your are done with it. Valgrind is a memory mismanagement detector. It shows you mernory leaks, deallocation errors, etc. Actually, Valgrind is a wra Use of uninitialised memory Reading Writing memory after it has been freed Reading/writing off the end of malloc'd blocks Reading Writing inappropriate areas on the stack Memory leaks where pointers to malloc'd blocks are lost forever Mismatched use of malloc newew vs free delete/delete Overlapping src and dst pointers in memcpy() and related functions Some misuses of the POSIX pthreads API To use this on our example program, test.e. try &CC test 8 test.c This creates an executable named test. To check for memory leaks during the execution of test, try valgrind --tool-memcheck leak-check-yes-show-reachable=yes - nun-callers-20 --track-fds-yes /test This outputs a report to the terminal like 59794 Memcheck, a memory error detector for x86-linux. *9794-- Copyright (C) 2002-2884, and GNU GPL d) by Julian Seward et al. --9704. Using valgrind-2.2.e, a program supervision framework for x86-linux. 9784 - Copyright (c) 2000-2084, and GNU GPL'd, by Julian Seward et al. --9784For more details, rerun with: v 29704- 9704 -9704 ERROR SUMMARY: O errors from a contexts (suppressed: 11 fron 1) --9794-mallos/free! In use at exit: 35 bytes in 2 blocks -9704- malloc/free: llocs, 1 frees, 47 bytes allocated. =9704 For counts of detected errors, rerun with -9704- searching for pointers to 2 not freed blocks. 9704-checked 1420940 bytes. 9704 9704 16 bytes in 1 blocks are definitely lost in loss record 1 of 2 29704 at ex18903038: nelloc (vg_replace_malloc.c:131) **9704 by @x8048386: main test.c115) 9704 1974 --9704-+ 19 bytes in 1 blocks are definitely lost in loss record 2 of 2 --9704 at ex18983038: malloc (Vg_replace_malloc.c:131) --9704- by Bx8948391: main testic:) -1971 9704 LEAK SUMMARY: -9704-- definitely lost: 35 bytes in 2 blocks. 3704 possibly lost: bytes in blocks. 9704- still reachable: a bytes in a blocks -9704 suppressed: bytes in o blocks! Let's look at the code to see what happened. Allocation +1 (19 byte leak) is lost because pis pointed elsewhere before the memory from allocate in test.c, line 8. Allocation 2 (12 byte leak) doesn't show up in the list because it is free d. Allocation shows up in the liste 15). Valgrind can detect many kinds of errors Here's an explanation of the various error messages A Heap of students (A6) Due Friday by 11:59pm Points 100 Overview The purpose of this lab is to give you a deeper understanding of memory management by forcing you to utilize the standard C++ heap structure as much as possible. Build a normalized student record system. Create a class to represent student data. You will also create classes to handle other specific types of data including dates and addresses. Your system will include all the necessary header files, cpp files, Makefile, and a main program to incorporate the larger system. Details . Imagine a university wants to keep track of the following data about each student: First name . Last name address line 1 address line 2 & city ment . state zip code date of birth month date of birth day date of birth year anticipated completion month anticipated completion day anticipated completion year Spa credit hours completed It is obvious that we will need a student class to contain all this data. However, the principles of data design indicate that the address should be its own class, as should the date. Your program should then have at least three classes: address, date, and student. Student will have two instances of date and one of address among its data members. . Process Build all the classes you will need for this project. Each class should have a separate header file. This file contains only the class definition. Ensure your headers use the #ifndef structure described in lecture, and include whatever other headers they need. Build a cpp file for each class which contains the code implementation of the class. This code file will include the class header file and any other headers and libraries needed. Build a main program that imports all the needed classes and tests them. You'll then modify this program. Create a makefile to control the compilation process. The instructor will test the program by running the make utility, 50 be sure your makefile works. If you use a visual editor like code:blocks, you'll still need to create and test a makefile for your project. Note IDE's have tools to build make files automatically, but they are often terrible. Make your own. It's must include to include clean and run builds in your makefile along with a command to run Valgrind. Look at Andy's example for guidance on how to create it, but the command should be called valgrind. Use git to manage your versions. There is no way you can prove you used git, but learn how to use it now. It's ideal for a larger project like this with multiple files All instances of your classes should be stored separately on the heap. That is to say, all should make use of the new keyword. Your program will be tested using the Valgrind tool to ensure you have responsibly deallocated memory when your are done with it. Valgrind is a memory mismanagement detector. It shows you mernory leaks, deallocation errors, etc. Actually, Valgrind is a wra Use of uninitialised memory Reading Writing memory after it has been freed Reading/writing off the end of malloc'd blocks Reading Writing inappropriate areas on the stack Memory leaks where pointers to malloc'd blocks are lost forever Mismatched use of malloc newew vs free delete/delete Overlapping src and dst pointers in memcpy() and related functions Some misuses of the POSIX pthreads API To use this on our example program, test.e. try &CC test 8 test.c This creates an executable named test. To check for memory leaks during the execution of test, try valgrind --tool-memcheck leak-check-yes-show-reachable=yes - nun-callers-20 --track-fds-yes /test This outputs a report to the terminal like 59794 Memcheck, a memory error detector for x86-linux. *9794-- Copyright (C) 2002-2884, and GNU GPL d) by Julian Seward et al. --9704. Using valgrind-2.2.e, a program supervision framework for x86-linux. 9784 - Copyright (c) 2000-2084, and GNU GPL'd, by Julian Seward et al. --9784For more details, rerun with: v 29704- 9704 -9704 ERROR SUMMARY: O errors from a contexts (suppressed: 11 fron 1) --9794-mallos/free! In use at exit: 35 bytes in 2 blocks -9704- malloc/free: llocs, 1 frees, 47 bytes allocated. =9704 For counts of detected errors, rerun with -9704- searching for pointers to 2 not freed blocks. 9704-checked 1420940 bytes. 9704 9704 16 bytes in 1 blocks are definitely lost in loss record 1 of 2 29704 at ex18903038: nelloc (vg_replace_malloc.c:131) **9704 by @x8048386: main test.c115) 9704 1974 --9704-+ 19 bytes in 1 blocks are definitely lost in loss record 2 of 2 --9704 at ex18983038: malloc (Vg_replace_malloc.c:131) --9704- by Bx8948391: main testic:) -1971 9704 LEAK SUMMARY: -9704-- definitely lost: 35 bytes in 2 blocks. 3704 possibly lost: bytes in blocks. 9704- still reachable: a bytes in a blocks -9704 suppressed: bytes in o blocks! Let's look at the code to see what happened. Allocation +1 (19 byte leak) is lost because pis pointed elsewhere before the memory from allocate in test.c, line 8. Allocation 2 (12 byte leak) doesn't show up in the list because it is free d. Allocation shows up in the liste 15). Valgrind can detect many kinds of errors Here's an explanation of the various error messages

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago