how to How to change button properties from another class?

Create a class to store data C#?

  • I need to write a C# class that has 5 data points, all of which have a default value, and need to store data in each. How would I go about this? Declaring the variables with the default values in them (string animalName = "whiskers"; for example) seems to eliminate the possibility of using an "if" statement, and I can't think of any other way to set default values..... The actual exam question: 1. Write a C# Class that will hold animal data in a file called animal.cs. The class should have appropriate data type of attributes for animal type, breed, color, gender, and cost. There should be attributes, properties, a default constructor that will set the default to “Cat”, “Siamese”, “Seal Point”, “Male”, 5000.00. There should also be a constructor that will accept the parameters to instantiate when needed. You will need to build a method to calculate sales tax of 7.5 percent based on the cost and store that amount in an attribute. Your gender public property should look for the values “F” or “M” and change the value to “Female” or “Male”. You do NOT have to create a program that uses this class; only create the class in your Visual Studio project. My Code so far: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ClassLibrary1 { public class animal { string animalType = "Cat"; string animalBreed = "Siamese"; string animalName = "Seal Point"; string animalGender = "Male"; decimal animalCost = 5000.00m; decimal totalCost; string animalType = Console.ReadLine(); string animalBreed = Console.ReadLine(); string animalName = Console.ReadLine(); string animalGender = Console.ReadLine(); decimal animalCost = Convert.ToDecimal(Console.ReadLine()); decimal totalCost = (animalCost * 1.07); if (string animalGender = "m") { string animalGender = "male"; } else if (string animalGender = "f") { string animalGender = female; } } }

  • Answer:

    The class I created should be large that it fits for the Java coding... Good luck!

Deane C at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.