1.2 Convert the following classes to valid C# classes: SemiDiode + ForwardV {get; set; }: Double +ReverseV (get; set; }: Double +BreakdownV {get, set; }: Double + Semi Diode) + SemiDiode(forwardV: Double, reverseV: Double, breakdownV: Double) +ToString(): String Laser LED wavelength: Int32 -color: String +Wavelength {get; set; } : Int32 +Laser() + Color (get; set; }: String +LED() +GetCopy(): Object SemiDiodes +this(Int32 index) {get; set; } : SemiDiode + SemiDiodes) + Add(newSemiDiode: SemiDiode): Void +Remove(oldSemiDiode: Semi Diode): Void .ToString() must return a meaningful string with all the properties Question 1 continues... • Valid values for color are: "RED", "GREEN", "BLUE", with "RED" being the default (recall from your first year the purpose of a public, non-automatic property) • Valid values for wavelength is the inclusive range from 405 to 3330 with 405 being the default (recall from your first year the purpose of a public, non-automatic property) • SemiDiodes is a collectionBase • Remember: Double, String and Int32 that you see in the UML are NOT the valid C# type names. You must convert the UML type names to the valid C# type names you started using in SOD1/SSD1.NO

Recommended Answers

All 4 Replies

The Reusable Code Snippet is for when you want to share your "Reusable Code Snippet." I look forward to your code in a future posting.

What have you actually tried?
What exactly is your problem?

We're not here to do your homework for you...

This looks like a jumbled unreadable mess.

I believe this would be more readable as:

# class description
SemiDiode 
    +ForwardV {get; set; }: Double 
    +ReverseV (get; set; }: Double 
    +BreakdownV {get, set; }: Double 
    +SemiDiode()  # default c'tor
    +SemiDiode(forwardV: Double, reverseV: Double, breakdownV: Double) +ToString(): String 

# class description
LaserLED 
    -wavelength: Int32 
    -color: String 
    +Wavelength {get; set; } : Int32 
    +Laser() # default c'tor
    +Color (get; set; }: String 
    +LED() +GetCopy(): Object 

# collection class description
SemiDiodes 
    +this(Int32 index) {get; set; } : SemiDiodes 
    +Add(newSemiDiode: SemiDiode): Void
    +SemiDiodes()  # default c'tor
    +Remove(oldSemiDiode: SemiDiode): Void 
  • Void .ToString() must return a meaningful string with all the properties.
  • Valid values for color are: "RED", "GREEN", "BLUE", with "RED" being the default (recall from your first year the purpose of a public, non-automatic property)
  • Valid values for wavelength is the inclusive range from 405 to 3330 with 405 being the default (recall from your first year the purpose of a public, non-automatic property)
  • SemiDiodes is a collectionBase
  • Remember: Double, String and Int32 that you see in the UML are NOT the valid C# type names. You must convert the UML type names to the valid C# type names you started using in SOD1/SSD1.NO

The comment about Void .ToString() seems to be a requirement, that each of these classes should have a default ToString() method which returns a representation of the object. Presumably, "SOD1/SSD1.NO" is some previous assignment.

None of this really changes the answer I'd give, which is: please show us what you've done on the assignment so far.

commented: +1 for effort. +16
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.