Write a program that creates a binary file

Assignment Help C/C++ Programming
Reference no: EM131089276

Program :- 8

A Hospital wants to create a database regarding its indoor patients. The information to store include
a) Name of the Patient
b) Date of Admission
c) Disease
d) Date of Discharge
Create a structure to store the date (year,month and date as its members). Create a base class to store the above information.The member function should include functions to enter information and display a list of all the patients in the database. Create a derived class to store the age of the patients.List the information about all the to store thje age of the patients .List the information about all the pediatric patients(less than twelve years in age)

 


Program :- 9

Write a program that creates a binary file by reading the data for the students from the terminal .The data of each student consist of roll no. ,name ( a string of 30 or lesser no. of characters ) and marks.
Program :- 10

Make a class Employee with a name and salary .Make a class Manager inherit from Employee. Add an instance variable , named department , of type string . Supply a method to tostring that prints the manager's name,Department and salary.Make a classs Executive inherit from Manger.Supply a method to string that prints the string "executive " followed by information stored in the manager superclass object. Supply a test program that tests these classes and methods.


Program :- 11

Imagine a tollbooth with a class called toll booth. The two data items are of type unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected. A constructor initializes both these to 0. A member functions called payingcar() increments the car total and adds 0.50 to the cash total. Another function , called nopaycar() , increments the car total but adds nothing to the cash total. Finallu a member function called displays the two totals.

Include a program to test this class. This program should allow the user to push one key to count a nopaycar.Pushing the ESZ key should cause the program to printout the total cars and total cash and then exit.

 

Program :- 12

Write a function called reversit() that reverses a string (an array of char ).Use a for loop that swaps the first and last characters , then the second and next to lastcharacters and so on. The string should be passed to reversit() as an argument.

Write a program to exercise reversit().The program should get a string from the usre, call reversit(), and print out the result.Use an input method trhat allows the embedded blanks.Test the program with Napoleons famous phrase ,"Able was I ere I Saw Elba)".

Program :- 13

Assume that a bank maintains two kinds of accounts for customers , one called as savings account and other as current account. The savings account provides compound interest and withdrawl facilities but no cheque book facility.The current account provides cheque book facility but no interest . Current account holders should also maintain a minimium balance and if the balance falls below this level , a service charge is imposed.

Create a class account that stores customer name,account number and type of accopunt . From this derive class es curr_acct and sav_acct to make them more specific to their requirements.
Include necessary member functions in order to achieve the following tasks:
a) Accept deposit from a customer and update the balance
b) Display the balance
c) Compute and deposit interest.
d) Permit Withdrawal and update the balance
e) Check for the minimum balance , impose penality ,necessary and update the balance .
f) Do not use any construtors.Use member functions to initializes the class members.


Program :- 14

Create a base shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to the base class, a member function get_data() to initialize base class data members and another member function display_area() to compute and display the area of figures.Make display_area() as a virtual function and redefine this function in the derived classes to suit their requirements.

Using these three classes , design a program that will accept dimensions of a triangle or a rectangle interactively and display the area.

Remember the two values given as input will be treated as lengths of two sides in the case of rectangles and as base and height in the case of triangles and used as follows:
Area of rectangle = x* y
Area of triangle = ½ * x * y

 

Reference no: EM131089276

Questions Cloud

You are the lead consultant for the excellent consulting : You are the lead consultant for the Excellent Consulting Group. It is mid-October. One of your top clients, Buddy's Floor Barn, has just closed the books for the first three quarters of the year (January through September). Buddy's Floor Barn request..
Greatest standard deviation of returns : By the history record for U.S. capital market, ________ had the smallest average annual return, and ________ had the greatest standard deviation (total risk) of returns.
Capital asset pricing model-the required rate of return : The stock of Verde Enviro-Systems has a beta of 1.9. If the current risk-free rate is 3% and the market risk premium is 5% then according to the Capital Asset Pricing Model, what should be the required rate of return (report as a percentage, i.e. 11...
Sell off enough of fixed assets at book value : Weber interstate paving co had 450 million of sales and 225 million of fixed assets last year, so its FA/sales ratio was 50%. However, its fixed assets were used at only 65% of capacity. If the company had been able to sell off enough of its fixed as..
Write a program that creates a binary file : Write a program that creates a binary file by reading the data for the students from the terminal .The data of each student consist of roll no. ,name ( a string of 30 or lesser no. of characters ) and marks.
Analysts have estimated that magnetek dividend : Magnetek Corp has just paid a dividend of $2 per share and you are now considering purchasing this stock. Analysts have estimated that Magnetek's dividend will grow at 4% per year in perpetuity. Given the riskiness of Magnetek stock, shareholders' re..
Raising a number n to a power p is the same as multiplying n : Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power () that takes a double value for n and an int value for p and returns the result as double value. Use a default argument of 2for p, so that ..
What is the market price per share of stock : Say you decide to start a firm and you need $500 million of capital to begin. You sell stock for its par value, a total of one million shares (par value is $200 per share), and sell $300 million of bonds at par value. You use the capital you just rai..
Recently issued bond with the characteristics : Duke Energy has recently issued a bond with the following characteristics: maturity: 20 years, coupon rate: 8% (paid semi-annually), face value: $1000. Your investment advisor has told you that the yield-to-maturity on this bond is 7.5%. What should ..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Calculate the net pay as the gross less the taxes

Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference.

  Create a variable that asks user what their monthly income

On average people in Las Cruces spend between 12-16% of their annual income on entertainment. Create a variable that asks the user what their MONTHLY income is and have an fprintf statement that says

  Write a c program to search a list of integers

Write a C program to search a list of integers for a particular value. The user should be prompted to enter the value to be searched for. Your program will then print out whether the value was found or not.

  Lists of integers and displays whether the two are identical

Write a test program that prompts the user to enter two lists of integers and displays whether the two are identical. Here are the sample runs.

  C++ program that reads in two positive integers

Write a C++ program that reads in two positive integers that are 20 or fewer digits in length and outputs the sum of the two numbers.

  User entry to a month value and display

Convert the user's entry to a Month value and display it.Create an enumeration named Planet that holds the names for the eight planets in our solar system, starting with MERCURY and ending with NEPTUNE.

  Application to accept the name of a folder

Therefore, she asks Hayley to modify the application to accept the name of a folder and display the following details of the files located in the folder: File name File size File creation date. Write the code that Hayley should write to create the..

  Write a test program to test the various operations

Write the definitions of the member functions as described in the definition of the class testClass.

  Design an algorithm to find the selling price

To make a profit, the prices of the items sold in a furniture store are marked up by 60%. Design an algorithm to find the selling price of an item sold at the furniture store. What information do you need to find the selling price?

  Program that asks the user to enter up to 100 integer score

Write a C program that asks the user to enter up to 100 integer scores, which are to be stored in an array. (You should allow the user to terminate input prior to entering all 100 scores.) The program should then display all the scores, ten per line,..

  Calculates the average of those numbers

Write a C program which takes n number of element from user (where, n is specified by user), stores data in an array and calculates the average of those numbers. Output of the program should look like this;

  Explain conditional expressions in the c language

What if the initial value assigned to a is 13, not 3? What happens with this code and why does this occur? What does this tell you about setting up conditional expressions in the C language?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd