Beginner here. I'm stuck on chapter 8 in my book: Nested If Statements.
Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(); int ID { Console.WriteLine("Enter Username"); string Name = Console.ReadLine(); if (Name.ToLower() == "administrator") } { Console.WriteLine("Welcome System Administrator. Enter your password."); if (Console.ReadLine() == "root") { Console.WriteLine("System Administrator logon successful!"); } else { Console.WriteLine("Invalid password. Please log on as guest."); } } else { Console.WriteLine("Welcome System User. Please enter the confirmation code to confirm you are a user of the mainframe."); if (Console.ReadLine() == "ibmmainframe7") { Console.WriteLine("Welcome System User. Please enter your ID"); ID = Console.ReadLine(); Console.WriteLine("Welcome system user # " ID); } else { Console.WriteLine("Welcome System Guest!"); } } Console.ReadLine(); } } }




Reply With Quote