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();}}
Create program that uses functions and reference parameters, and asks user for the outside temperature.
Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles
Calculate and store the average for each row and column. Determine and store the values for the Average Map.
Write a webservices application that does a simple four function calculator
Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.
Explain Model-View-Controller paradigm
How many levels of nesting are there in this design?
Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.
Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.
Design a base class shape with virtual functions
Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data
Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.
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