Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CompanyInfo
- {
- static void Main()
- {
- //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.
- Console.Write("Company name: ");
- string cname = Console.ReadLine();
- Console.Write("Company address: ");
- string caddress = Console.ReadLine();
- Console.Write("Phone number: ");
- string cphone = Console.ReadLine();
- if (string.IsNullOrEmpty(cphone))
- {
- cphone = "(no company phone)";
- }
- Console.Write("Fax number: ");
- string cfax = Console.ReadLine();
- if (string.IsNullOrEmpty(cfax))
- {
- cfax = "(no fax)";
- }
- Console.Write("Web site: ");
- string csite = Console.ReadLine();
- Console.Write("Manager first name: ");
- string manfirst = Console.ReadLine();
- Console.Write("Manager last name: ");
- string manlast = Console.ReadLine();
- Console.Write("Manager age: ");
- string mAge = Console.ReadLine();
- if (string.IsNullOrEmpty(mAge))
- {
- mAge = "(no age)";
- }
- Console.Write("Manager phone: ");
- string mPhone = Console.ReadLine();
- if (string.IsNullOrEmpty(mPhone))
- {
- mPhone = "(no phone)";
- }
- Console.WriteLine(Environment.NewLine + "{0}\n" + "Address: {1}\n" + "Tel. {2}\n" + "Fax: {3}\n" + "Web site: {4}\n" + "Manager: {5}" + " " + "{6}" + " (age: {7}, tel. {8})"
- , cname, caddress, cphone, cfax, csite, manfirst, manlast, mAge, mPhone);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment