Question

In: Computer Science

1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables:...

1. Create a console program in C#,

* Create a class: "Student.cs"

* Add 3 variables: StudentName (string), SchoolYear (int), YearsUntilGraduation(int)

* Method YTK() = 12 - SchoolYear;

2. Main

*Enter name

*Enter age

*You will attend school:____ years before graduating.

Solutions

Expert Solution

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Student
{
class Student
{
public string StudentName;
public int SchoolYear;
   public int YearsUntilGraduation;
   public int age;
  

    public int YTK(int Schoolyear)
{
int sch_year = 12- schoolyear ;
   return sch_year;   
}

public void data()
{
Console.WriteLine("Enter Name: ");
SName = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Age: ");
age = Console.ReadLine();
   Console.WriteLine("");
   Console.WriteLine("Enter School Year: ");
SchoolYear= Console.ReadLine();
    YearsUntilGraduation = YTK(SchoolYear);   
}
  
    public void Display()

{

Console.WriteLine("");
Console.WriteLine("Student's Name: {0}", StudentName);
Console.WriteLine("");
  
Console.WriteLine(" Age: {0}", age);
Console.WriteLine("");
   Console.WriteLine("You will attend school: {0} years before graduating.", YearsUntilGraduation);
   Console.WriteLine("");
  

}

class Student1
{

static void Main(string[] args)
{
Student S1 = new Student();
S1.data();
S1.Display();
}
}
}
}   


Related Solutions

Using C# Create the “TestQuestion” class. It will have two class variables: 1) a question and...
Using C# Create the “TestQuestion” class. It will have two class variables: 1) a question and 2) the answer to that question. Please create an accessor and mutator method for both of those variables, without which we would not be able to see or change the question or the answer. There should be a constructor method. We will also have a “ToString” or “__str__” method, which will print the question followed by its answer. The constructor method has two parameters...
Problems create a C++ program that will do the followings - define 3 double variables x,...
Problems create a C++ program that will do the followings - define 3 double variables x, y, z - calculate the value of y as the following formula: y = 2*x*x+4*x+5 and print x and y; - assign a new value to x: x=5.6 - calculate the value of z as the following formula z = (y*y)/4 + (x*x)/5 - print x, y,x
(In C++) Bank Account Program Create an Account Class Create a Menu Class Create a main()...
(In C++) Bank Account Program Create an Account Class Create a Menu Class Create a main() function to coordinate the execution of the program. We will need methods: Method for Depositing values into the account. What type of method will it be? Method for Withdrawing values from the account. What type of method will it be? Method to output the balance of the account. What type of method will it be? Method that will output all deposits made to the...
In this class add Comparable interface. In the driver program create a few objects and In...
In this class add Comparable interface. In the driver program create a few objects and In the driver program create a few objects and compare them . then create a list of those objects and sort them .A Quadratic is bigger than another Quadratic if it opens faster package pack2; /** * This is a program for defining a quadratic equation * @author sonik */ public class Quadratic { public int coeffX2 = 0; public int coeffX = 0; public...
Needs to be written in C# Console App! Create a base class BankAccount. Decide what characteristics...
Needs to be written in C# Console App! Create a base class BankAccount. Decide what characteristics are common for checking and saving accounts and include these characteristics in the base class. Define derived classes for checking and savings. In your design , do not allow the banking base account to be instantiated --only the checking and saving classes. Use a Program class to test your design.
~~~USING C# ONLY~~~ Create a console application Design a class named Person with properties for holding...
~~~USING C# ONLY~~~ Create a console application Design a class named Person with properties for holding a person’s name, address, and telephone number. Design a class named Customer, which is derived from the Person class. The Customer class should have the variables and properties for the customer number, customer email, a spentAmount of the customer’s purchases, and a Boolean variable indicating whether the customer wishes to be on a mailing list. It also includes a function named calcAmount that calculates...
C++ * Program 2:      Create a date class and Person Class.   Compose the date class...
C++ * Program 2:      Create a date class and Person Class.   Compose the date class in the person class.    First, Create a date class.    Which has integer month, day and year    Each with getters and setters. Be sure that you validate the getter function inputs:     2 digit months - validate 1-12 for month     2 digit day - 1-3? max for day - be sure the min-max number of days is validate for specific month...
1. Implement the Vehicle class.  Add the following private instance variables to the Accoun class:...
1. Implement the Vehicle class.  Add the following private instance variables to the Accoun class: • An instance variable called wheelsCount of type int • An instance variable called vType of type String • An instance variable called isTruck of type boolean .  Add getters and setters for the three instance variables  Add the following methods to the Account class: • A void method called initialize that takes a parameter of type int, a String,and one double...
Create a Visual Studio console project (c++) containing a main() program that declares a const int...
Create a Visual Studio console project (c++) containing a main() program that declares a const int NUM_VALUES denoting the array size. Then declare an int array with NUM_VALUES entries. Using a for loop, prompt for the values that are stored in the array as follows: "Enter NUM_VALUES integers separated by blanks:" , where NUM_VALUES is replaced with the array size. Then use another for loop to print the array entries in reverse order separated by blanks on a single line...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class definitions, one base class and three derived classes. The derived classes will have an inheritance relationship (the “is a” relationship) with the base class. You will use base and derived classes. The base class will have at least one constructor, functions as necessary, and at least one data field. At least one function will be made virtual. Class members will be declared public and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT