Question #46328

The development team of SoftSols Inc. analyzes the source code of the existing software and notes the following observations: The software contains a private class, named bookTickets, that contains the methods used to perform ticket bookings for various flights. There is no class or function that can be used to check the maintenance details of FlyHigh's aircrafts. Based on the preceding observations, the development team decides to perform the following tasks: Reuse the functions of the bookTickets class in a new class, named bookETicket, to add the feature of e-ticket booking. Create a new class named viewMaintenance that allows the maintenance personnel of FlyHigh Airlines to view the maintenance details of aircrafts. Write the code snippet that the development team should use to accomplish each of the preceding tasks.
1

Expert's answer

2014-09-23T04:50:46-0400

Here is the processed document with the code fragments restored and formatted:

---

Problem:

The development team of SoftSols Inc. analyzes the source code of the existing software and notes the following observations: The software contains a private class, named bookTickets, that contains the methods used to perform ticket bookings for various flights. There is no class or function that can be used to check the maintenance details of FlyHigh's aircrafts. Based on the preceding observations, the development team decides to perform the following tasks: Reuse the functions of the bookTickets class in a new class, named bookETicket, to add the feature of e-ticket booking. Create a new class named viewMaintenance that allows the maintenance personnel of FlyHigh Airlines to view the maintenance details of aircrafts. Write the code snippet that the development team should use to accomplish each of the preceding tasks.

Solution:

CODE (Program.cs)


using System;
public class Program
{
    private class bookTickets
    {
        public void Book()
        {
            Console.WriteLine("The ticket is booked!");
        }
    }
    // Inheritance
    private class bookETicket : bookTickets
    {
        public void ETicketBooking()
        {
            Console.WriteLine("The e-ticket is booked!");
        }
    }
    public static void Main()
    {
        // bookTicket
        bookETicket ticketsBooker = new bookETicket();
        ticketsBooker.Book();
        ticketsBooker.ETicketBooking();
        // viewMaintenance
        viewMaintenance mainViewer = new viewMaintenance("name", "password");
        mainViewer.View();
        Console.WriteLine("Hello, World!");
        Console.ReadLine();
    }
}
using System;


CODE (viewMaintenance.cs)


public class viewMaintenance
{
    bool logined;
    private bool check(string name, string password)
    {
        return true;
    }
    public viewMaintenance(string name, string password)
    {
        if (check(name, password))
        {
            logined = true;
        }
        else
        {
            logined = true;
        }
    }
    public void View()
    {
        if (logined)
        {
            Console.WriteLine("Information for maintenance personnel!");
        }
    }
}


OUTPUT


The ticket is booked!
The e-ticket is booked!
Information for maintenance personnel!
Hello, World!


http://www.AssignmentExpert.com/

---

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS