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

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.
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...
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...
Create a C++ program that consists of the following: In maincreate the following three variables:...
Create a C++ program that consists of the following: In main create the following three variables: A char named theChar A double named theDouble An int named theInt Fill each of these variables with data taken as input from the keyboard using a single cin statement. Perform the following task on each variable: Increment theChar by one Decrement theDouble by two Square theInt This should be done on separate lines. Output the value of each variable to the screen on...
Create a project called rise. Add a class called GCD. Complete a program that reads in...
Create a project called rise. Add a class called GCD. Complete a program that reads in a numerator (as an int) and a denominator (again, as an int), computes and outputs the GCD, and then outputs the fraction in lowest terms. Write your program so that your output looks as close to the following sample output as possible. In this sample, the user entered 42 and 56, shown in green. Enter the numerator: 42 Enter the denominator: 56 The GCD...
C++ program homework question 1 1. Create and implement a class called clockType with the following...
C++ program homework question 1 1. Create and implement a class called clockType with the following data and methods (60 Points.): Data: Hours, minutes, seconds Methods: Set and get hours Set and get minutes Set and get seconds printTime(…) to display time in the form of hh:mm:ss default and overloading constructor Overloading Operators: << (extraction) operator to display time in the form of hh:mm:ss >> (insertion) operator to get input for hours, minutes, and seconds operator+=(int x) (increment operator) to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT