Skip to content

Commit d09884f

Browse files
committed
Fixing issues in Foundation 1 and 2
1 parent 87ec600 commit d09884f

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

final/Foundation1/Description1.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Description of Foundation 1 program
2+
3+
In developing the YouTube video program, I have applied the abstraction principle. By utilizing the Video and Comment classes,
4+
I have abstracted away unnecessary complexities and focused on the core attributes and functionalities. The Video class provides
5+
a simplified representation of a video, emphasizing details like the title, author, and length. Similarly, the Comment class
6+
encapsulates comment-related information, such as the commenter's name and text. This abstraction has improved the overall
7+
code by enhancing maintainability, readability, and emphasizing the essential aspects of the program's logic.

final/Foundation1/Program.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,6 @@ static void Main(string[] args)
4747

4848
videosList.Add(video3);
4949

50-
// Video 4
51-
Video video4 = new Video("Exploring Peruvian Textile Art: Preserving Tradition and Culture", "Juan Perez Garcia", 5.25);
52-
53-
Comment video4Comment1 = new Comment("Valentina", "Peruvian textile craftsmanship is so beautiful. I appreciate the effort and talent of our artists.");
54-
Comment video4Comment2 = new Comment("Andrés", "I love how you connect with local artisans. Their work is invaluable.");
55-
Comment video4Comment3 = new Comment("Isabella", "The details in the textiles are stunning. Peruvian art is truly exceptional.");
56-
57-
video4.ListComment(video4Comment1);
58-
video4.ListComment(video4Comment2);
59-
video4.ListComment(video4Comment3);
60-
61-
videosList.Add(video4);
62-
6350
foreach (Video video in videosList)
6451
{
6552
video.DisplayInfo();

final/Foundation1/Videos.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class Video
66
private string _author;
77
private double _length;
88
private List<Comment> _comments = new List<Comment>();
9-
9+
1010
public Video(string title, string author, double length)
1111
{
1212
_title = title;
@@ -32,7 +32,6 @@ public void DisplayInfo()
3232
foreach (Comment comment in _comments)
3333
{
3434
comment.DisplayInfo();
35-
}
36-
35+
}
3736
}
3837
}

final/Foundation2/Description2.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Description of Foundation 2 program
2+
3+
In this project, I have implemented the encapsulation principle by creating separate classes for Product,
4+
Order, Customer, and Address. Each class encapsulates its own data and behavior, ensuring that the internal
5+
implementation details are hidden from other classes. The Product class encapsulates product details, such
6+
as the name, ID, price, and quantity, providing a clear and organized structure for managing product-related
7+
information. The Order class encapsulates the concept of an order, including a list of products and a customer,
8+
allowing for easy manipulation and calculation of total price and shipping cost. The Customer class encapsulates
9+
customer information, like the name and address, protecting the data and providing methods to access and manipulate
10+
it in a controlled manner. The Address class encapsulates address-related details, enabling the generation of full
11+
address strings and checking if the address is from the USA. This implementation of encapsulation improves code
12+
organization, data hiding, and separation of concerns, resulting in maintainable and reusable code.

final/Foundation2/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void Main(string[] args)
2222

2323
Console.WriteLine("Order Number: 1");
2424
order1.DisplayResults();
25-
Console.WriteLine("-------- Order Complete --------\n");
25+
Console.WriteLine();
2626

2727
// Order 2
2828
Address address2 = new Address("352 St", "Good Year", "AZ 85001", "USA");
@@ -41,7 +41,7 @@ static void Main(string[] args)
4141

4242
Console.WriteLine("Order Number: 2");
4343
order2.DisplayResults();
44-
Console.WriteLine("-------- Order Complete --------\n");
44+
Console.WriteLine();
4545

4646
// Order 3
4747
Address address3 = new Address("2010 W 500 S", "Salt Lake", "UT 84104", "USA");
@@ -58,6 +58,6 @@ static void Main(string[] args)
5858

5959
Console.WriteLine("Order Number: 3");
6060
order3.DisplayResults();
61-
Console.WriteLine("-------- Order Complete --------\n");
61+
Console.WriteLine();
6262
}
63-
}
63+
}

0 commit comments

Comments
 (0)