Ask Question, Ask an Expert


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

Write a program where you create a class called bankaccount

Write a program where you create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two const ...

1 solve a simple payroll calculation find amount of pay

1. Solve a simple payroll calculation. Find amount of pay given hours worked and hourly rate. (pay = hourly rate * hours worked.) Run this values (hours = 30 and rate = 8.52) and with (hours = 53 and rate = 11.54). Show ...

Develop a program that displays information about a family

Develop a program that displays information about a family member or friend. This program should print out information about what you like best about him or her. You might even describe your pet, if you have one. Present ...

Assignmenta near expert at introductory problem solving and

Assignment A near expert at introductory problem solving and programming, you've decided to put your skills to good use by volunteering at SecurityCon, a security conference for IT professionals. The conference has space ...

Create a very basic calculator map out the numeric keypad

Create a very basic calculator, map out the numeric keypad (17 buttons) and an EditText view. If text is given, prompt the user with a message that complains about the error. Toast.makeToast(getApplicationContext() , "er ...

Spreadsheet exercise1 run the spreadsheet program in your

Spreadsheet Exercise 1. Run the spreadsheet program in your computer and type the following:   A B C D E F 1 PAYROLL 2 XYZ COMPANY Employee Name Department Degree Salary Need Increase? 3 Nasser Mechanical Master 15000   ...

Complete case programming assignment at the end of chapter

Complete Case Programming Assignment at the end of Chapter 4, page 283. Be sure to create an event planning document for each event in the program prior to writing code. Write the code that will execute the program requi ...

Assignmentreference this assignment is an object oriented

Assignment Reference: This assignment is an object oriented version of the In-class assignment. The functionality supported for a single vehicle in ICA 01 would be extended to multiple vehicles using a single class Car, ...

Write a lex program that converts a le to pig latin

Write a Lex program that converts a le to Pig Latin." Specially, assume the le is a sequence of words (groups of letters) separated by whitespace. Every time you encounter a word: 1. If the First letter is a consonant, m ...

Assignmentanalyze each problem develop a solution and

Assignment Analyze each problem, develop a solution and implement your solution. Copy and paste your program and a sample output below each problem. Define the class Point in a rectangular coordinate system. This class m ...

  • 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

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen