Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

problem 1: (Airline Reservations System): A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You are to prepare an application to assign seats on each flight of the airline's only plane (capacity: 10 seats).

Your application must display the given alternatives: Please type 1 for First Class and Please type 2 for Economy. If the user types 1, your application must assign a seat in the first-class section (seats 15). If the user types 2, your application must assign a seat in the economy section (seats 610).

Use a 1-dimensional array of simple type bool to symbolize the seating chart of the plane. Initialize all the elements of the array to false to point out that all the seats are empty. As each seat is assigned, set the corresponding element of the array to True to point out that the seat is no longer available.

Your application must never assign a seat which has already been assigned. When the economy section is full, your application must ask the person if it is acceptable to be placed in the first-class section (and vice-versa). If yes, make the proper seat assignment. If no, display the message ‘Next flight leaves in 3 hours’.

problem 2: (Set of Integers): Make class IntegerSet. Each IntegerSet object can hold integers in the range 0 - 100. The set is represented by an array of bools. Array element a[i] is true if integer i is in the set. Array element a[j] is false if integer j is not in the set. The parameter less constructor initializes the array to the ‘empty set’ (that is, a set whose array representation contains all false values).

Provide the given methods:

a) Method Union makes a third set which is the set-theoretic union of two existing sets (that is, an element of the third set’s array is set to true if that element is true in either or both of the existing sets - or else, the element of the third set is set to false).

b) Method Intersection makes a third set which is the set-theoretic intersection of two existing sets (that is, an element of the third set’s array is set to false if that element is false in either or both of the existing sets - or else, the element of the third set is set to true).

c) Method InsertElement inserts a new integer k to a set (by setting a[k] to true).

d) Method DeleteElement deletes integer m (by setting a[m] to false).

e) Method ToString returns a string containing a set as a list of numbers separated by spaces. Comprise only such elements which are present in the set. Use --- to represent an empty set.

f) Method IsEqualTo finds out whether two sets are equivalent.

prepare an application to test class IntegerSet. Instantiate some IntegerSet objects. Test that all your methods work suitably.

problem 3: (Tic-Tac-Toe): Make class TicTacToe which will enable you to prepare a complete application to play the game of Tic-Tac-Toe. The class comprises of a private 3-by-3 rectangular array of integers. The constructor must initialize the empty board to all 0s. Allow two human players. Wherever the first player moves, place a 1 in the specified square and place a 2 wherever the second player moves. Each move should be to an empty square. After each move, find out whether the game has been won and whether it’s a draw. If you feel ambitious, alter your application so that the computer makes the moves for one of the players. As well, permit the player to specify whether he or she wants to go first or second. If you feel exceptionally ambitious, develop an application which will play three-dimensional Tic-Tac-Toe on a 4-by-4-by-4 board.

problem 4: (Package Inheritance Hierarchy): Package-delivery services, like FedEx®, DHL® and UPS®, offer a number of various shipping options, each with specific costs associated. Make an inheritance hierarchy to represent different kinds of packages. UsePackage as the base class of the hierarchy, then comprise classes TwoDayPackage and OvernightPackage that derive from Package. Base class Package must comprise the name, address, city, state and zip code for the package’s sender and recipient, and instance variables that store the weight (in ounces) and cost per ounce to ship the package. Package’s constructor must initialize such private instance variables with public properties. Make sure that the weight and cost per ounce contain positive values. Package must provide a public method find outCost which returns a decimal pointing out the cost related with shipping the package. Package’s find outCost method must find out the cost by multiplying the weight by the cost per ounce. Derived class TwoDayPackage must inherit the functionality of base class Package, however as well comprises an instance variable which represents a flat fee the shipping company charges for two-day delivery service. TwoDayPackage’s constructor must receive a value to initialize this instance variable. TwoDayPackage must redefine method find outCost so that it find outs the shipping cost by adding the flat fee to the weight-based cost computed by base class Package’s find outCost method. ClassOvernightPackage must inherit directly from class Package and contain an instance variable representing an additional fee per ounce charged for overnight delivery service. OvernightPackage must redefine method find outCost so that it adds the additional fee per ounce to the standard cost per ounce before computing the shipping cost. prepare a test application which makes objects of each kind of Package and tests method find outCost.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91962

Have any Question?


Related Questions in Programming Language

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As