Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C# to slove the project Instructions Within the Main method of your application, write C# statements for following parts. 1. Rename your Program.cs file

Use C# to slove the project

image text in transcribed

Instructions Within the Main method of your application, write C# statements for following parts. 1. Rename your Program.cs file to CourseApp.cs. 2. Add another class to the project. Name it Course.cs.

Create the following Properties to manage the state of the object. When you create properties you need to 1) create the field and 2) create the property with the get/set accessors. 1. Create a public property, CourseName of type string as follows: 1.1. Declare a private instance variable of type string called courseName. courseName will be non-static. 1.2. Create a get accessor for the Property. The get accessor returns courseName 1.3. Create a set accessor for the Property. The set accessor assigns value to the private variable (courseName). Make sure you do not use quotes. 2. Create a public property, CourseNumber of type integer as follows: 2.1. Declare a private instance variable of type integer called courseNumber. courseNumber will be non-static. 2.2. Create a get accessor for the Property. The get accessor returns courseNumber 2.3. Create a set accessor for the Property. The set accessor assigns value to the private variable (courseNumber). Make sure you do not use quotes.

3. Create a public property, CollegeName of type string as follows: 3.1. Declare a private static variable of type string called collegeName 3.2. Create the get accessor for the Property. The get accessor returns collegeName 3.3. Create the set accessor for the Property. The set accessor assigns value to the private variable (collegeName). Make sure you do not use quotes.

4. Create a public property ClassAverage of type double, with only a get accessor as follows: 4.1. Declare a private instance variable of type double called classAverage (non-static). Initialize it with the value 0.0. 4.2. Create the get accessor for the Property. The get accessor returns classAverage.

5. Create a public method, named DisplayMessage. Choose a return type yourself. 5.1. The method should print out a one line message to the Console, e.g.,Welcome to CIS 340. The course name should not be hardcoded. The method should use a placeholder and use the CourseName property to write the course name. This way it will pick up the value of whatever course name the object has in it.

In the CourseApp class, do the following. 6. Within the Main method, 6.1. Declare two objects references, courseOne and courseTwo of type Course. These should be done in a manner similar to how it is demonstrated in class. e.g., Classname objectReference; // data type followed by name of object Do the following separately for each of your two Course object references. 6.2. Instantiate a new Course object. Store the resulting reference in your Course object reference. e.g., objectReference = new ClassName(); // instantiate a new ClassName and assign in to the objectReference 6.3. Set the CourseName and CourseNumber using the set accessor. This means use the assignment symbol! Ask user for input using a ReadLine and store it in CourseName and CourseNumber. 6.4. Set the CollegeName using the set accessor. Do not ask the user. Hardcode ASU. 6.5. Similarly, try setting the ClassAverage to 85. Does it let you? Why / Why not? 6.6. Print the CourseNumber and the CollegeName to the Console in the format. Use the get accessor to read the properties. e.g., A new Course was created for 425 at ASU The way to use the get accessor is shown below. Type in the name of the object reference and access the property after placing a dot, just like how you call methods except that there will be no parentheses. e.g. WriteLine(objectReference.MemberName); 6.7. Call the DisplayMessage() method for the objects, e.g., objectReference.MethodName();

Sample Output file://G:/CIS 340 Spring 2017/Anclass/1C13_Course-Properties/GradeBook/bin/Debug/GradeBook.E. lease enter the first course name: Programming lease enter the course number: 340 new Course has been created for 340 at ASU elcome to the grade book for Programming! lease enter the second course nane: Web Design and Programming lease enter the course number: 425 new Course has been created for 425 at ASU elcome to the grade book for Web Design and Programming

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_2

Step: 3

blur-text-image_3

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

List out some inventory management techniques.

Answered: 1 week ago

Question

=+employee to take on the international assignment?

Answered: 1 week ago