Question

1. Create a class called computer as a separate C# file that includes the following private...

1. Create a class called computer as a separate C# file that includes the following private attributes (data items) of the class: Manufacturer, Model Number and Price\

2. Create properties for each attribute to get and set private data.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the answer below, have mentioned all the details in the comments:

Computer.cs

using System;

//computer class
public class Computer{
//private attribute manufacturer
private string manufacturer;
//getter and setter property of the Manufacturer
public string Manufacturer{
get { return manufacturer; }
set { manufacturer = value; }
}
  
//priave attribute modelNumber
private int modelNumber;
//getter and setter property of the Model number
public int ModelNumber{
get { return modelNumber; }
set { modelNumber = value; }
}
  
//private attribute price
private int price;
//getter and setter property of the price
public int Price{
get { return price; }
set { price = value; }
}

   static public void Main (){
       //Code
   }
}

There will be no output as we have defined only the attributes and properties.

Add a comment
Know the answer?
Add Answer to:
1. Create a class called computer as a separate C# file that includes the following private...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is done in C++ Create an Employee class using a separate header file and implementation...

    This is done in C++ Create an Employee class using a separate header file and implementation file. Review your UML class diagram for the attributes and behaviors The calculatePay() method should return 0.0f. The toString() method should return the attribute values ("state of the object"). Create an Hourly class using a separate header file and implementation file. The Hourly class needs to inherit from the Employee class The calculatePay() method should return the pay based on the number of hours...

  • 3. Design and implement a class called ClassStats, in a file called stats.py, that includes: •...

    3. Design and implement a class called ClassStats, in a file called stats.py, that includes: • private attributes for a student number and status (pass or fail), • private class variables to keep track of the total number of students with status pass and the total number of students with status fail, • a constructor with default values (empty strings) for all instance variables, • an accessor method for each instance variable and also for the class vari- ables, •...

  • Program must be written in C++: Create a parent class called CompSciProfessor. Each professor has name...

    Program must be written in C++: Create a parent class called CompSciProfessor. Each professor has name (type string), email (type string), and facultyId (type long). Specialize the CompSciProfessor class into two more classes: AdjunctProf, and TenureTrackProf classes. The specialized class AdjunctProf has three attributes of its own: degree (type char), NoOfTA (type int), and NoOfCourses (type int). The attribute ‘degree’ refers to the degree of the adjunct professor. You assign ‘B’ to represent bachelor degree, ‘M’ for Master degree, and...

  • You are to create a class called Item which contains the following private variables:  string name;  // Will...

    You are to create a class called Item which contains the following private variables:  string name;  // Will be received from files. int weight;  //random number from 1-10 The class Weapon is derived from Item.  The variable for that class is int atk;  //random number from 1-10 The class Armor is derived from Item.  The variable for that class is int def;  //random number from 1-10 You will have 2 files.  One called "Weapons.txt" which has the following: Sword Dagger Bow Lance Mace The "Armors.txt" file...

  • You are to create a class called Item which contains the following private variables:  string name;  // Will...

    You are to create a class called Item which contains the following private variables:  string name;  // Will be received from files. int weight;  //random number from 1-10 The class Weapon is derived from Item.  The variable for that class is int atk;  //random number from 1-10 The class Armor is derived from Item.  The variable for that class is int def;  //random number from 1-10 You will have 2 files.  One called "Weapons.txt" which has the following: Sword Dagger Bow Lance Mace The "Armors.txt" file...

  • PYTHON Task 1 Create a class called Window It has 2 public properties 1 private property...

    PYTHON Task 1 Create a class called Window It has 2 public properties 1 private property 1 constructor that takes 3 arguments pass each argument to the appropriate property Task 2 In a new file import the Window class Instantiate the Window object Output the two public properties Task 3 Alter the Window class in Task 1 Add an accessor and mutator (the ability to access and change) to the private property Task 4 Create a class named Instrument Give...

  • Write a c# console program called “ArrayOfThings” where you create a class called Staff with private...

    Write a c# console program called “ArrayOfThings” where you create a class called Staff with private fields for StaffID and StaffName. Create Properties that can write data and retrieve data from these private fields. Create a Staff array that can hold up to ten Staff objects. Create ten objects using a for loop that automatically creates a new (empty) Staff object at each iteration of the loop and adds that object into the Staff array. Write data into the first...

  • Draw a UML design class diagram that shows the following information. You are to create class...

    Draw a UML design class diagram that shows the following information. You are to create class attribute and method names and other information using correct syntax. You can include the drawing in this Word document or in an additional PowerPoint file. The domain class is a concrete entity class named House. All attributes are private strings with initial null values. The attribute house identifier has the property of “key.” The other attributes are the builder of the house, the model...

  • In Java: Requirements: 1. Create a class called Bike. 2. Create these private attributes: int currentSpeed...

    In Java: Requirements: 1. Create a class called Bike. 2. Create these private attributes: int currentSpeed int currentGear String paintColor 3. Create a constructor that takes 2 arguments: speed, gear, color. 4. Create another constructor that takes no arguments. 5. Create a method called goFaster(int amount) which increases the speed by the given amount. 6. Create a method called brake() which sets the speed to 0. 7. Create a method called print() which describes the bike and the speed it...

  • FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width,...

    FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT