Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


Course: 159100 Programming for Engineering and Technology

Assessment: 01 Computer Program

Course Learning Outcomes Assessed:

•    Define variables and perform input/output operations.

•    Control program flow with conditional and iteration statements.

•    Write, compile and debug C++ programs.

Weighting: 30 %

Due Date: TBC

This is an individual assessment.

Introduction

Students’, staff’, and visitors’ health and safety is an important consideration for the School of Food and Advanced Technology (SF&AT) and Massey University.

To ensure everyone’s wellbeing, it is important that we know who is on the premises, who they are meeting with, how to contact them, when they arrived, and whether they have left the premises or not.

Currently, a paper-based approach is used to record when a visitor arrives and leaves the premises. It has been proposed that a computer program be developed and used instead.

In this assessment, you are required to write a C++ program that records when a visitor arrives and leaves SF&AT’s premises.

Aims

The assessment’s aims are for you to demonstrate proficiency in:

1.   Writing, building, and running a C++ program.

2.    Defining a variable and using it.

3.    Loading data into a variable and displaying its value.

4.    Using statements to control the flow of a program.

5.    Using functions.

6.    Reading data from a file.

Objectives

Your program should:

1.    Check if the file welcome.txt exists. If it does, the program will open the file and display its contents.

2.    Check if a data.txt file exists. If it does not, the program will create a new file and write the following text to it:

First Name, Last Name, Phone Number, Contact, In Time, Out Time

3.    Prompt the user to either sign in or sign out.

4.   When a user signs in, they are prompted to type in:

o Their first name.

o Their last name.

o Their phone number.

o The name of the person they are meeting.

o The current time.

Afterwards, the user’s first name, last name, phone number, contact, and current time is appended to data.txt.

5.   When a user signs out, they are prompted to type in:

o Their first name.

o Their last name.

o The current time.

Afterwards, if the user has signed in, the line in data.txt that contains the user’s first name and last name has the current time appended to its end.

In addition, the program should:

1.   Verify user input and provide feedback, e.g., if a user tries to sign in, but has not provided the required information, prompt them to retry (and enter all information).

2.    Loop continuously until the ‘q’ or ‘Q’ keys are pressed.

Expected Output

The following examples illustrate what happens when displaying the file welcome.txt’s contents, a user signing in, a user signing out, and the program being exited.

Displaying the file welcome.txt’s contents:

Welcome to Massey University's School of Food and Advanced Technology (SF&AT).

The user signing in:

What would you like to do? Press 'I' to check-in, 'O' to check-out, 'L' to log-in. i

What is your first name?

Frazer

What is your last name?

Noble

What is your phone number?

1234

Who are you here to meet?

Sen

What is the time?

09:00

Thank you Frazer for signing in. Enjoy your visit!

At this stage, data.txt contains the following data:

First Name,Last Name,Phone Number,Contact,In Time,Out Time

Frazer,Noble,1234,Sen,09:00,

The user signing out:

What would you like to do? Press 'I' to check-in, 'O' to check-out, 'L' to log-in. o

What is your first name?

Frazer

What is your last name?

Noble

What is the time?

09:10

Thank you Frazer for signing out. We hope you enjoyed your visit!

At this stage, data.txt contains the following data:

First Name,Last Name,Phone Number,Contact,In Time,Out Time

Frazer,Noble,1234,Sen,09:00,09:10

Exiting the application:

What would you like to do? Press 'I' to check-in, 'O' to check-out, 'L' to log-in. q

Requirements

You are required to:

1.   Write a C++ program that implements the assessment’s objectives.

2.   Write a report describing what you did, how, and why.

In addition, the program must:

•    Use SignIn() and SignOut() functions.

•    Use a pointer.

•    Use a reference.

Resources

You will be provided with the following:

1.   A marking rubric.

Submission Instructions

Add all your source code files and summary to a .zip archive and name it in the following format: FIRSTNAME_LASTNAME_ID.zip. Do not include your build directory.

Upload your submission to Stream before the due date.

Hints

You will find the following headers helpful:

1.   fstream

2.    iostream

3.    string

The std::getline() function can be used to read a whole line from std::cin, including spaces, e.g.,

std::cout << "What is the time?" << std::endl;

std::string now{};

>> 1:00 PM (user types in “1:00 PM”, which contains whitespace)

std::getline(std::cin, now); // now == “1:00 PM” (contains whitespace).

Frequently Asked Questions

Q. What should I include in the report?

A. You should include:

•    An introduction section. Here, you should introduce the project and mention what you did and what the project’s outcome was.

•    A methodology section. Here, you should describe what you did, how, and why in detail. Include figures, tables, and code snippets.

•    A results section. Here, you should describe the project’s outcome in detail. Relate what you achieved to what you were required to do.

•    A conclusion section. Here, you should mention what you did and how well the project’s outcome address the assessment’s requirements.

Q. What Integrated Development Environment (IDE) should I use?

A. You should use Qt Creator.

Q. What compiler should I use?

A. You should use Qt’s MinGW kit’s compiler.

Q. Can I get an extension?

A. Only in critical personal circumstances. Extensions will be granted at the offering coordinator’s discretion. Last minute computer failure” and loss” of data/files are very common excuses and are not acceptable. Plan to complete the assessment a few days before the deadline. Start early! Do not underestimate the time it will take to get a working application and write a good report.


Program Marking Rubric

The program is worth 2/3 of the assessment’s final grade.

D Range (40 49.99)

C Range (50 64.99)

B Range (65 79.99)

A Range (80 100)

Weighting

Does not Meet Expectations

Below Expectations

Meets Expectations

Exceeds Expectations.

Program

The program is poor. It does some of        what it needs to do and can be improved a lot.

The source code is not formatted, is hard to read, and has no comments.

Inappropriate variable names are used.

The program rarely uses conditional structures, loop structures, and        functions.

The source code does not build.

The program does not run.

The program is adequate. It does what it needs to do, but could be improved.

The source code is formatted in places, is hard to read, and has few comments.

Appropriate variable names are rarely used.

The program uses conditional structures, loop structures, and functions, but how   they are used could be improved upon.

The source code builds, but has a lot of warnings or issues.

The program runs, but has a lot of issues.

The program is good. It does everything it needs to do.

The source code is formatted, is readable, and has some comments.

Appropriate variable names are mostly used.

The program uses conditional structures, loop structures, and functions.

The source code builds, but has a few warnings or issues.

The program runs, but has a few issues.

The program is excellent. It does everything it needs to do and more.

The source code is formatted clearly, is easy to read, and uses comments          effectively.

Appropriate variable names are used consistently.

Conditional structures, loop structures, and functions are used effectively.

The source code builds without any issues.

The program runs without any issues.

100 %

Comments: