Created
October 7, 2014 12:49
-
-
Save IvanNikolov/545e29d87b68085ec90d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
//A company has name, address, phone number, fax number, web site and manager. | |
//The manager has first name, last name, age and a phone number. | |
//Write a program that reads the information about a company | |
//and its manager and prints it back on the console. | |
class PrintCompanyInformation | |
{ | |
static void Main() | |
{ | |
Console.Write("Company name: "); | |
string companyName = Console.ReadLine(); | |
Console.Write("Company address: "); | |
string companyAddress = Console.ReadLine(); | |
Console.Write("Company number: "); | |
string companyNumber = Console.ReadLine(); | |
Console.Write("Company Fax: "); | |
string companyFax = Console.ReadLine(); | |
Console.Write("Company Web site: "); | |
string companyWebSite = Console.ReadLine(); | |
Console.Write("Manager first name: "); | |
string managerFirstName = Console.ReadLine(); | |
Console.Write("Manager last name: "); | |
string managerLastName = Console.ReadLine(); | |
Console.Write("Manager age: "); | |
int managerAge = int.Parse(Console.ReadLine()); | |
Console.Write("Manager phone number: "); | |
string managerPhone = Console.ReadLine(); | |
string manager = managerFirstName + " " + managerLastName; | |
companyFax = "no fax"; | |
Console.WriteLine(); | |
//Option 1 - not verry presentable and easy to read | |
//Console.WriteLine("{0}\nAddress: {1}\nTel. {2}\nFax: {3}\nWeb site: {4}\nManager: {5} (age:\n {6}, Tel. {7})",companyName,companyAddress,companyNumber,companyFax,companyWebSite,manager,managerAge,managerPhone); | |
//Option 2 - easier to follow an dlook trough. | |
Console.WriteLine(companyName); | |
Console.WriteLine("Address: " + companyAddress); | |
Console.WriteLine("Tel. " + companyNumber); | |
Console.WriteLine("Fax: " + companyFax); | |
Console.WriteLine("Web site: " + companyWebSite); | |
Console.WriteLine("Manager: {0}\n({1}, tel. {2})", manager, managerAge, managerPhone); | |
//Another way - straight to the point | |
//string companyName = "Software University"; | |
//string companyAddress = "26 V. Kanchev, Sofia"; | |
//string companyNumber = "+359 899 55 55 92"; | |
//string companyFax = "(no fax)"; | |
//string companyWebSite = "http://softuni.bg"; | |
//string managerFirstName = "Svetlin"; | |
//string managerLastName = "Nakov"; | |
//int managerAge = 25; | |
//string managerPhone = "+359 2 981 981"; | |
//string manager = managerFirstName +" "+ managerLastName; | |
//Console.WriteLine(companyName); | |
//Console.WriteLine("Address: " + companyAddress); | |
//Console.WriteLine("Tel. " + companyNumber); | |
//Console.WriteLine("Fax: " + companyFax); | |
//Console.WriteLine("Web site: " + companyWebSite); | |
//Console.WriteLine("Manager: {0}\n({1}, tel. {2})",manager,managerAge,managerPhone); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment