Skip to content

Commit 22d8dfb

Browse files
author
ScorcH0x1
committed
Remove .idea folder from repository
1 parent 0687cc1 commit 22d8dfb

File tree

6 files changed

+35
-620
lines changed

6 files changed

+35
-620
lines changed

.idea/.gitignore

-8
This file was deleted.

.idea/FixAllSystems.iml

-2
This file was deleted.

.idea/editor.xml

-580
This file was deleted.

.idea/misc.xml

-7
This file was deleted.

.idea/modules.xml

-8
This file was deleted.

src/main.cpp

+35-15
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Course# : CS115-1601A-01
66
// Course : Programming with C++
77
// Instructor : Instructor Charles Hale
8-
// Version : Week 5 - 5
9-
// Last updated: January 2025
8+
// Version : Week 5 February 08, 2016
9+
// Last updated: January 28, 2025
1010
// Copyright : Educational Purposes
11-
// Description : C++, Ansi-style Successful Compile, Run, and updated application with objects, classes, functions, pointers
11+
// Description : C++, Ansi-style Successful Compile, Run, and updated application with objects, classes, functions, pointers, input validation, error logging
1212
//============================================================================
1313

1414
#include <iostream>
@@ -40,20 +40,23 @@ class StoredCustomerData {
4040
public:
4141

4242
void setCustomerFirstName() {
43+
// Display the opening statement once
44+
cout << "Welcome to Fix All Systems Inc." << endl;
45+
cout << "*******************************" << endl;
46+
cout << "Create your Customer Account for faster check-out and SAVINGS!!!" << endl;
47+
cout << "*******************************" << endl;
48+
4349
while (true) {
44-
cout << "Fix All Systems Inc." << endl;
45-
cout << "*******************************" << endl;
46-
cout << "Create your Customer Account for faster check-out and SAVINGS!!!" << endl;
47-
cout << "*******************************" << endl;
50+
// Prompt for first name
4851
cout << "Enter your First Name: ";
4952
cin >> customerFirstName;
5053

5154
// Validate input
5255
if (validateInput(customerFirstName, "^[A-Za-z]{1,50}$")) {
53-
break;
56+
break; // Exit the loop if input is valid
5457
} else {
5558
string errorMsg = "Invalid first name: " + customerFirstName;
56-
logError(errorMsg);
59+
logError(errorMsg); // Log the error
5760
cout << "Invalid input. Please try again." << endl;
5861
}
5962
}
@@ -66,7 +69,7 @@ class StoredCustomerData {
6669

6770
// Validate input
6871
if (validateInput(customerLastName, "^[A-Za-z]{1,50}$")) {
69-
break;
72+
break; // Exit the loop if input is valid
7073
} else {
7174
string errorMsg = "Invalid last name: " + customerLastName;
7275
logError(errorMsg);
@@ -82,7 +85,7 @@ class StoredCustomerData {
8285

8386
// Validate input
8487
if (validateInput(zipCode, "^\\d{5}$")) {
85-
break;
88+
break; // Exit the loop if input is valid
8689
} else {
8790
string errorMsg = "Invalid zip code: " + zipCode;
8891
logError(errorMsg);
@@ -183,17 +186,34 @@ int main() {
183186
cout << "Welcome to the Customer Information Program!" << endl;
184187
cout << "Please enter the requested details below." << endl;
185188

186-
StoredCustomerData customerData;
189+
StoredCustomerData* customerData = new StoredCustomerData();
187190

188191
// Collect and validate user input
189-
customerData.setCustomerFirstName();
190-
customerData.setCustomerLastName();
191-
customerData.setZipCode();
192+
customerData->setCustomerFirstName();
193+
customerData->setCustomerLastName();
194+
customerData->setZipCode();
195+
196+
// Display newly created customer account and use object
197+
// to get values from private variables in the class.
198+
// Accessing member class "StoredCustomerData" using the member access operator (->) to retrieve stored data in memory.
199+
cout << "Your new Customer Account has been created:" << endl;
200+
201+
// Utilize the reference operator to display the memory address for the customer account number
202+
cout << "Account Number: " << customerData << endl;
203+
204+
// Display the full customer information using getter methods
205+
cout << "Welcome " << customerData->getCustomerFirstName() << " " << customerData->getCustomerLastName() << endl;
206+
cout << "From ZIP Code: " << customerData->getZipCode() << endl;
207+
cout << "*******************************" << endl;
208+
cout << "*******************************" << endl;
192209

193210
// Create and display the service list
194211
ServiceList services;
195212
services.displayServiceList();
196213

214+
// Free allocated memory
215+
delete customerData;
216+
197217
return 0;
198218
}
199219

0 commit comments

Comments
 (0)