1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kati45 [8]
3 years ago
12

For this assignment you will be creating an array of objects or a list of objects of car parts based on user input. 1. Create a

Parts class with the following items a. Properties for PartNum, Part Name, Part Description, and Cost b. Must have a constructor 2. In the main you will need accomplish the following: a. Ask the user how many objects they wish to enter b. Create an array of parts objects c. Loop appropriately to collect the data needed to populate the objects in the array d. Next you will do the following: i. Give the user a menu of all parts ii. Ask the user which part they would like to view data on iii. Create a method to print out the object selected by user values.
Computers and Technology
1 answer:
s2008m [1.1K]3 years ago
5 0

Answer:

C# code for the problem is given below

Explanation:

Program:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PartsDemo

{

class Parts

{

int partNum;

string partName, partDescription;

double cost;

public Parts(int no,string name,string desc,double cst)

{

partNum = no;

partName = name;

partDescription = desc;

cost = cst;

}

public void print()

{

Console.WriteLine("Part Number: "+partNum );

Console.WriteLine("Part Name: "+partName );

Console.WriteLine("Part Description: "+partDescription );

Console.WriteLine("Cost: "+cost);

}

}

class Program

{

static void Main(string[] args)

{

int numObjects;

Console.Write("How many objects you wish to enter: ");

numObjects = Convert.ToInt32(Console.ReadLine());

//array of objects

Parts[] parts = new Parts[numObjects];

int no;

string name, desc;

double cst;

//entering details of parts from user

for (int i = 0; i < numObjects; i++)

{

Console.Write("Enter part no: ");

no = Convert.ToInt32(Console.ReadLine());

Console.Write("Enter part name: ");

name = Console.ReadLine();

Console.Write("Enter description: ");

desc = Console.ReadLine();

Console.Write("Enter cost: ");

cst = Convert.ToDouble(Console.ReadLine());

parts[i] = new Parts(no,name,desc,cst);

}

Console.WriteLine("\nMenu options: ");

Console.WriteLine("------------------");

for (int i = 0; i < numObjects; i++)

{

Console.WriteLine(i+". Part"+(i+1));

}

//view the selected part by entering its index number

int index;

Console.Write("\nPlease enter the index of a part to view data: ");

index = Convert.ToInt32(Console.ReadLine());

parts[index].print();

Console.ReadKey();

}

}

}

You might be interested in
What are the steps to open the Custom AutoFilter dialog box?
uranmaximum [27]

Answer:

data, sort and filter, text filters

Explanation:

ed 2020

7 0
3 years ago
Read 2 more answers
Who can help me on my school we will to google meet and i share my screen
Deffense [45]
Me ......................
7 0
4 years ago
Compared with traditional methods, the entire rapid application development (RAD) process is expanded and, as a result, the new
tensa zangetsu [6.8K]

Answer:

<u>False</u>

Explanation:

Note, the Rapid Application Development (RAD) software development approaches are noteworthy not for its expanded design details but for <u>its simplicity of the software development process.</u>

In other words, the RAD approaches while taking user preferences into the software development process, focuses on making the software design process more flexible, such as by employing the use of prototypes, and less unnecessary details.

5 0
3 years ago
What items should you evaluate when scouting the facilities at a shooting location?
Fiesta28 [93]

I would evaluate baggage and personal belongings, rooms or closets, people's clothing, and if anyone has a weapon.

3 0
3 years ago
What are the values of the following expressions? In each line assume that,
MissTica

Answer:

double x = 2.5;

double y = -1.5;

int m = 18;

int n = 4;

string s = "Storm";

string t = "Watch";

The output of the expression "x + n*y - (x+n)*y" is "6.25".

and the output of expression "m/n + m%n" is "6".

Explanation:

for the first expression,

x + n*y - (x+n)*y ,put value of every variables in it.

=2.5+4*(-1.5)-(2.5+4)*(-1.5)

=2.5-6.0-(6.5*(-1.5)

=-3.5+9.75

=6.25

for the second expression,

m/n + m%n,  put value of every variables in it.

=18/4 +18%4

=4+2      ("/ will give quotient and % will give remainder")

=6

4 0
4 years ago
Other questions:
  • What command would you use to list the text files in your
    7·1 answer
  • What can a parent do to help a child adjust to a new culture or area
    7·2 answers
  • How many questions must you answer in Brainly to be able to message people?
    6·2 answers
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • Instead of terminating the series, the producers decided to extend it for an additional season. In the sentence above, which of
    13·1 answer
  • GAMER OYUNCU KOLTUĞU % YERLİ
    6·1 answer
  • Port explorers ​are tools used by both attackers and defenders to identify (or fingerprint) the computers that are active on a
    6·1 answer
  • A motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors
    8·1 answer
  • What does Amara hope will<br> happen when Dad sits on the sofa?
    8·1 answer
  • What is e banking effects
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!