Question

4. Motor Class Create an application that tracks electric motors in a manufacturing plant. The ap- plication should have a Motor class with the following properties: . Motorld: . Description: String e RPM: Five-digit string, such as 02340 Voltage: - Status: Double, values in the range 10 to 10000 Double, values in the range 1 to 500 String, three characters
media%2Ffc2%2Ffc243fea-40bc-415e-aca1-d8
0 0
Add a comment Improve this question Transcribed image text
Answer #1

As you have not included the programming language I am using Java.

Motor.java

public class Motor{

private String MotorId, Description, Status;

@Override

public String toString() {

return "Motor MotorId=" + MotorId + "\n\tDescription=" + Description

+ "\n\tStatus=" + Status + "\n\tRPM=" + RPM + "\n\tVoltage="

+ Voltage + "\n";

}

public Motor(String motorId, String description, double rPM,

double voltage, String status) {

MotorId = motorId;

Description = description;

Status = status;

RPM = rPM;

Voltage = voltage;

}

public String getMotorId() {

return MotorId;

}

public void setMotorId(String motorId) {

MotorId = motorId;

}

public String getDescription() {

return Description;

}

public void setDescription(String description) {

Description = description;

}

public String getStatus() {

return Status;

}

public void setStatus(String status) {

Status = status;

}

public double getRPM() {

return RPM;

}

public void setRPM(double rPM) {

RPM = rPM;

}

public double getVoltage() {

return Voltage;

}

public void setVoltage(double voltage) {

Voltage = voltage;

}

private double RPM, Voltage;

}

Driver.java

import java.util.Scanner;

public class Driver{

public static void main(String args[]){

Scanner in = new Scanner(System.in);

Motor motors[] = new Motor[10];

motors[0] = new Motor("01125", "1st motor", 550, 20, "ON");

motors[1] = new Motor("12546", "2nd motor", 750, 200, "OFF");

motors[2] = new Motor("32856", "3rd motor", 445, 159, "MNT");

motors[3] = new Motor("78542", "4th motor", 745, 459, "NA");

motors[4] = new Motor("98521", "4th motor", 357, 45, "ON");

motors[5] = new Motor("01125", "1st motor", 550, 20, "ON");

motors[6] = new Motor("12546", "2nd motor", 750, 200, "OFF");

motors[7] = new Motor("32856", "3rd motor", 445, 159, "MNT");

motors[8] = new Motor("78542", "4th motor", 745, 459, "NA");

motors[9] = new Motor("98521", "4th motor", 357, 45, "ON");

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

System.out.println(motors[i]);

}

}

**Comment for any further queries.

Add a comment
Know the answer?
Add Answer to:
4. Motor Class Create an application that tracks electric motors in a manufacturing plant. The ap-...
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
  • Create an application that tracks electric motors in a manufacturing plant (Python and C++). The application...

    Create an application that tracks electric motors in a manufacturing plant (Python and C++). The application should have a Motor class with the following properties: MotorId: Five digit string, such as "02340" Description: String RPM: Double, values in the range 10 to 10000 Voltage: Double, values in the range 1 to 500 Status: String, three characters The Status values are: ON: Motor is online and running OFF: Motor is online but not running MNT: Motor is undergoing maintenance and cleaning...

  • Create an application that tracks electric motors in a manufacturing plant. The application should have a...

    Create an application that tracks electric motors in a manufacturing plant. The application should have a Motor class with the following properties: MotorId: Five digit string, such as "02340" Description: String RPM: Double, values in the range 10 to 10000 Voltage: Double, values in the range 1 to 500 Status: String, three characters The Status values are: ON: Motor is online and running OFF: Motor is online but not running MNT: Motor is undergoing maintenance and cleaning NA: Motor isn't...

  • Using C# Create an application class named LetterDemo that instantiates objects of two classes named Letter...

    Using C# Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods. The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the Name of the recipient and the Date mailed (stored as strings). Next, include a ToString() method that overrides the Object class’s ToString() method and returns a string that contains the name of...

  • JAVA Use the class, Invoice, provided to create an array of Invoice objects. Class Invoice includes...

    JAVA Use the class, Invoice, provided to create an array of Invoice objects. Class Invoice includes four instance variables; partNumber (type String), partDescription (type String), quantity of the item being purchased (type int0, and pricePerItem (type double). Perform the following queries on the array of Invoice objects and display the results: Use streams to sort the Invoice objects by partDescription, then display the results. Use streams to sort the Invoice objects by pricePerItem, then display the results. Use streams to...

  • C# Goals: Practice building a class Use object oriented programming to solve a problem Problem Description:...

    C# Goals: Practice building a class Use object oriented programming to solve a problem Problem Description: Create a Windows Console Application using the .NET Framework For this application you will be designing a program that allows users to keep track of robot inventory. First, you will design a Robot class, and then build an application that creates Robot objects. Important formulas / relationships: Before we begin designing robots, we should understand a few key electrical terms and relationships. Terms: Voltage...

  • The Account class Create a class named Account, which has the following private properties: number: long...

    The Account class Create a class named Account, which has the following private properties: number: long balance: double Create a no-argument constructor that sets the number and balance to zero. Create a two-parameter constructor that takes an account number and balance. First, implement getters and setters: getNumber(), getBalance(), setBalance(double newBalance). There is no setNumber() -- once an account is created, its account number cannot change. Now implement these methods: void deposit(double amount) and void withdraw(double amount). For both these methods,...

  • In a new file located in the same package as the class Main, create a public...

    In a new file located in the same package as the class Main, create a public Java class to represent a photograph that consists of a linear (not 2D) array of pixels. Each pixel is stored as an integer. The photograph class must have: (a) Two private fields to represent the information stored about the photograph. These are the array of integers and the date the photograph was taken (stored as a String). The values in the array must be...

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