Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Define a class named Payment that contains a member variable of type double that stores the amount of the payment and appropriate accessor and mutator methods. Also, create a method named paymentDetails that outputs an English sentence to describe the amount of the payment. Next, define a class named CashPayment that is derived from Payment. This class should redefine the paymentDetails method to indicate that the payment is in cash. Include appropriate constructor(s). Define a class named CreditCardPayment that is derived from Payment. This class should contain member variables for the name on the card, expiration date, and credit card number. Include appropriate constructor(s).
Finally, redefine the paymentDetails method to include all credit card information in the printout. Create a main method that creates at least two CashPayment and two CreditCardPayment objects with different values and calls paymentDetails for each.
CodeMate Hints/*** This program introduces inheritance through a problem of* creating two types of Payments, Cash and Credit. The* paymentDetails method outputs in English a sentence that describes* the payment.*//*** Base class that holds payment amount provides a method for returning* a description of the payment.*/public class Payment{//Payment amountprivate double amount;//Constructor to initialize amount to 0public Payment(){amount = 0.0;}/*** Constructor to initialize payment amount*/public Payment(double paymentAmount){amount = paymentAmount;}/*** Sets the payment amount*/public void setPayment(double paymentAmount){amount = paymentAmount;}/*** Returns the payment amount*/public double getPayment(){return amount;}/*** Prints a description of the payment*/public void paymentDetails(){System.out.println("The payment amount is " + amount);}public static void main(String[] args){// Create several test classes and invoke the paymentDetails methodPayment cash1 = new CashPayment(50.5);Payment cash2 = new CashPayment(20.45);Payment credit1 =new CreditCardPayment(10.5, "Fred", "10/5/2010", "123456789");Payment credit2 =new CreditCardPayment(100, "Barney", "11/15/2009", "987654321");System.out.println("Cash 1 details:");cash1.paymentDetails();System.out.println();System.out.println("Cash 2 details:");cash2.paymentDetails();System.out.println();System.out.println("Credit 1 details:");credit1.paymentDetails();System.out.println();System.out.println("Credit 2 details:");credit2.paymentDetails();System.out.println();}}
What is stored in beta after each of the following statements executes?
Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (upper- or lowercase) to a digit and leaves all other characters intact
For decryption, the main program should create an ifstream for the file to be decrypted. It should use the getline method of the ifstream to read lines from the file, call the encryption / decryption function with the line to be decrypted, and dis..
Develop a polymorphic banking application using the Account hierarchy you created. Create the following two SavingsAccount objects and two CheckingAccount objects and store them in an array called "arrays" of Account references to the objects
Provide a short code example of the use of C++ syntax within the context of an employee database and determine the manner in which each of the provided concepts relates to the concept of object-oriented programming.
Jake Company, which manufactures electrical switches, uses a standard cost system and carries all inventories at standard. The standard manufacturing overhead costs per switch are based on direct labor hours and are shown below:Variable overhead (5 h..
1. An open box is to be made from a square piece of cardboard whose sides are 17 in long, by cutting squares of equal sizes from the corners and bending up the sides. Determine the size of the square that is to be cut out so that the volume may be ma..
Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user.
you need to create a program that counts the number of numbers between 150 and 200 - Can you write this program in c language? You need to implement a function that counts the numbers.
Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule:
Calculates the student * averages and quiz averages based upon input from the user. Modify this program to read in the following grade text file, * with a maximum number of students set to 35 and having five quiz scores for each student. The output s..
Write a class called fibs that generates numbers in the Fibonacci sequence (each number is the sum of the previous two). The sequence starts 1, 1, 2, 3, 5, ...
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!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd