Define a class named Payment that contains an instance variable of type double that stores the amount of the payment and appropriate get and set methods. Also, create a method named paymentDetails that outputs an English sentence to describe the payment amount. 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 instance 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. Define a class named PaymentTest class that contains the main() method that creates two CashPayment and two CreditCardPayment objects with different values and calls paymentDetails for each. (5 pts)

Answers

Answer 1

Answer:

The code is given below:

class Payment

{

private double amount;  

public Payment( )          

{

   amount = 0;

}

public Payment(double amount)

{

  this.amount = amount;

}

public void setPayment(double amount)

{

    this.amount = amount;

}

public double getPayment( )

{

   return amount;

 }

public void paymentDetails( )

{

   System.out.println("The payment amount is " + amount);

}

}

class CashPayment extends Payment

{

       public CashPayment( )

       {

             super( );

       }

      public CashPayment(double amt)

     {

      super(amt);

      }

     public void paymentDetails( )

    {

     System.out.println("The cash payment amount is "+ getPayment( ));

     }

}

class CreditCardPayment extends Payment

{

       private String name;

       private String expiration;

       private String creditcard;

       public CreditCardPayment()

      {

             super( );

            name = " ";

             expiration = " ";

              creditcard = "";

      }

       public CreditCardPayment(double amt, String name, String expiration, String creditcard)

      {

             super(amt);

             this.name = name;

             this.expiration = expiration;

             this.creditcard = creditcard;

      }

         public void paymentDetails( )

        {

           System.out.println("The credit card payment amount is " + getPayment( ));

           System.out.println("The name on the card is: " + name);

           System.out.println("The expiration date is: " + expiration);

           System.out.println("The credit card number is: " + creditcard);

      }

}

class Question1Payment

{

      public static void main(String[ ] args)

       {

         CashPayment cash1 = new CashPayment(50.5), cash2 = new CashPayment(20.45);

         CreditCardPayment credit1 = new CreditCardPayment(10.5, "Fred", "10/5/2010",

                                                                                                "123456789");

         CreditCardPayment 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( );

       }

}

Output:

Define A Class Named Payment That Contains An Instance Variable Of Type Double That Stores The Amount

Related Questions

Which one is the result of the ouWhen you move a file to the Recycle Bin, it will be immediately deleted from your computer.

A. True

B. Fals

Answers

Answer:

B => false

Explanation:

it just keep it on recycle bin => not being removed

False

Explaination :

The deleted file will stay in Recycle Bin for a short period of time before it's permanently deleted from your computer

Which of the following are advantages of a local area network, as opposed to a wide area network? Select 3 options.

provides access to more networks

higher speeds

more secure

lower cost

greater geographic reach

Answers

higher speeds lower cost more secure

Answer:

✅ more secure

✅ lower cost

✅ higher speeds

Explanation:

Edge 2022

Which Windows installation method requires that you manually rename computers after the installation?​

Answers

Answer:

Command line

Explanation:

After installation of the machine one needs to manually rename the computer. This can be done through the start then settings, then system, and select rename the PC in the right-hand side column.

Which is not a MARKETING impact of technology?

Social
Cultural
Economic
Environmental

Answers

Answer:

the answer is environmental

write a C++ program that receives a number as input from the user ,and checks whether it is greater than 8 and less than 10 or not and print the result

Answers

num_in = float (input = ("Please enter a number from 0 to ten: "))

def cmp_num(num_in):

try:

if num_in > 8 and num_in < 10:

print ("{0} is greater than 8 and less than 10".format(num_in) )

elif num_in < 8 and num_in < 10:

print (" {0} is less than 8 and less than 10".format(num_in) )

else:

print ("{0} is out of the restriction".format (num_in))

except ValueError:

print ("Invalid input")

correct single error in this. Try to appear relaxed, but not to relaxed​

Answers

Try to appear relaxed, but not to relaxed .

Differentiate between email and NIPOST System

Answers

Answer: NIPOST System is sending mail physical like photos and letters and many items

Email is electronic  mail sent through the internet but you can send it anywhere

Explanation:

In securing the client/server environment of an information system, a principal disadvantage of using a single level sign-on
password is the danger of creating a(n)
A
administrative bottleneck
B
trap door entry point
С
lock-out of valid users
D
Single point of failure

Answers

Answer:

C

Explanation:

The slope and intercept pair you found in Question 1.15 should be very similar to the values that you found in Question 1.7. Why were we able to minimize RMSE to find the same slope and intercept from the previous formulas? Write your answer here, replacing this text.

Answers

I don’t get the question

Write equivalent predicate statement for Every teacher who is also a painter loves Bob​

Answers

Answer:

Every teacher who is also a painter loves Bob

I have no idea how to answer this question so I’m just gonna

how did hitles rules in nazi germany exemplify totiltarian rule?

Answers

Answer:

hope this helps if not srry

Write programming code in C++ for school-based grading system. The program should accept the Subject and the number of students from a user and store their details in an array of type Student (class). The student class should have: • studName, indexNo, remarks as variables of type string, marks as integer, and grade as char. • A void function called getData which is used to get students’ details (index number, name, and marks). • A void function called calculate which will work on the marks entered for a student and give the corresponding grade and remarks as give below. Marks Grade Remarks 70 – 100 A Excellent 60 – 69 B Very Good 50 – 59 C Pass 0 – 49 F Fail • Should be able to display the results for all students (index number, name, marks, grade, remarks). 2. Draw a flowchart for the calculate function above. 3. Create a folder with name format ICTJ254_indexnumber (eg

Answers

Answer:

Explanation:

// C++ Program to Find Grade of Student

// -------codescracker.com-------

#include<iostream>

using namespace std;

int main()

{

   int i;

   float mark, sum=0, avg;

   cout<<"Enter Marks obtained in 5 Subjects: ";

   for(i=0; i<5; i++)

   {

       cin>>mark;

       sum = sum+mark;

   }

   avg = sum/5;

   cout<<"\nGrade = ";

   if(avg>=91 && avg<=100)

       cout<<"A1";

   else if(avg>=81 && avg<91)

       cout<<"A2";

   else if(avg>=71 && avg<81)

       cout<<"B1";

   else if(avg>=61 && avg<71)

       cout<<"B2";

   else if(avg>=51 && avg<61)

       cout<<"C1";

   else if(avg>=41 && avg<51)

       cout<<"C2";

   else if(avg>=33 && avg<41)

       cout<<"D";

   else if(avg>=21 && avg<33)

       cout<<"E1";

   else if(avg>=0 && avg<21)

       cout<<"E2";

   else

       cout<<"Invalid!";

   cout<<endl;

   return 0;

}

The Lisp function LENGTH counts the number of elements in the top level of a list. Write a function ALL-LENGTH of one argument that counts the number of atoms that occur in a list at all levels. Thus, the following lists will have the following ALL-LENGTHs.
(A B C) => 3
((A (B C) D (E F)) => 6
(NIL NIL (NIL NIL) NIL ) => 5

Answers

Answer:

bc

Explanation:

What are computer programs that make it easy to use and benefit from techniques and to faithfully follow the guidelines of the overall development methodology

Answers

Answer:

A Tool

Explanation:

Tools are computer programs that make it simple to use and benefit from techniques while adhering to the overall development methodology's guidelines. The correct option is A).

What are computer programs?

A computer-aided software development case tool is a piece of software that aids in the design and development of information systems. It can be used to document a database structure and provide invaluable assistance in maintaining design consistency.

A computer software application is one that is developed to assist a particular organizational function or process, such as payroll systems, market analysis, and inventory control.

The goal of introducing case tools is to reduce the time and cost of software development, while also improving the quality of the systems created.

Therefore, the correct option is A) Tools.

To learn more about computer programs, refer to the below link:

https://brainly.com/question/9963733

#SPJ2

The question is incomplete. Your most probably complete question is given below:

A) Tools

B) Techniques

C) Data flow

D) Methodologies

Which of the given assertion methods will return true for the code given below? Student student1 = new Student(); Student student2 = new Student(); Student student3 = student1;
The Student class is as follows.
public class Student{
private String name;
}
a. assertEquals(student1, student2);
b. assertEquals(student1, student3);
c. assertSame(student 1, student3);
d. assertSame(student1, student2);

Answers

Answer:

The true statements are :

A. assertEquals(student1,student2)  

C. assertSame(student1,student3)

Explanation:

AssertEquals() asserts that the objects are equal, but assertSame() asserts that the passed two objects refer to the same object or not, if found same they return true, else return false.

Methods are collections of named code segments that are executed when evoked

The assertion method that will return true for the given code is: assertEquals(student1,student2)  

The code segment is given as:

Student student1 = new Student();

Student student2 = new Student();

Student student3 = student1;

In Java, the assertEquals() method returns true if two objects have equal values.

Assume student1 and student2 have equal values, the statement assertEquals(student1,student2) will return true

Read more about java methods at:

https://brainly.com/question/15969952

Scenarios are quite common where an IT professional is tasked with modify a file on many computer systems or many files on a single computer or a combination of the two. For example, a large software may need the copyright notice comment to be changed on every source file in the project. Or, a configuration file may need to be modified on every server in a multi-server deployment. Doing this task manually is not a viable way to approach the problem. Instead, a better solution is to use a scriptable environment to perform search and replace functionality on the files in question. Python is an excellent tool for this kind of task.
Description
Samba is a unix/linux file sharing suite of programs designed to provide Windows interoperable file and print sharing services. Much of the configuration for the Samba daemon is provided by the text file smb.conf (renamed to smb.txt for this assignment). After an update was deployed to three dozen linux servers it was discovered that a couple of configured parameters were incorrect. Unfortunately, since there are unique aspects to each server, copying the contents of a single file to each server is not a viable solution. To fix the problem, the IT department must connect to each server, edit the smb.conf file, and restart the smbd daemon. To automate this task, each server will have a Python script copied to it. Then an SSH session will be initiated to each server from which the script will be executed. Your task is to write the Python script.
The invocation of the script must be as follows:
python modify.py fileSpec "from" "to"
where,
modify.py is the name of your script
fileSpec is the name of the file to be modified (smb.txt)
"from" is the text to be searched for (be sure to enclose any white space in quotes.
"to" is the text the searched text is to be replaced with.
Testing the script is your responsibility. However a good test case is:
python modify.py smb.txt "password sync = yes" "password sync = no"

Answers

Answer:

Explanation:/

The example Python script that can be used to automate the modification of the smb.conf file on multiple Linux servers is shown below

What is the code?

python

import subprocess

import sys

def modify_smb_conf(file_spec, search_text, replace_text):

   try:

       # Open the file for reading

       with open(file_spec, 'r') as file:

           # Read the contents of the file

           file_contents = file.read()

       # Perform the search and replace operation

       modified_contents = file_contents.replace(search_text, replace_text)

       # Open the file for writing

       with open(file_spec, 'w') as file:

           # Write the modified contents back to the file

           file.write(modified_contents)

       # Print a success message

       print(f"Modification successful: Replaced '{search_text}' with '{replace_text}' in {file_spec}")

   except IOError as e:

       # Print an error message if there was an issue with file operations

       print(f"Error: {e}")

def main():

   # Check if the correct number of command line arguments are provided

   if len(sys.argv) != 4:

       print("Usage: python modify.py fileSpec \"from\" \"to\"")

       return

   # Extract the command line arguments

   file_spec = sys.argv[1]

   search_text = sys.argv[2]

   replace_text = sys.argv[3]

   # Call the function to modify the smb.conf file

   modify_smb_conf(file_spec, search_text, replace_text)

if __name__ == '__main__':

   main()

Read more about  code here:

https://brainly.com/question/29330362

#SPJ2

By Using the following schema, answer the following SQL queries and commands: Product(P_code.P_name, P_price, P_on_hand,vend_code) Vender(vend_code, vend_fname, vend_areacode, vend_phone) 1- find the venders names who sell products in TN-5 area and their names include "dan". 2- find the code, name and vender code of product that has price between 1500S and 2500S and the product that has price between 48005 and 5600S. 3- Find the name, and code of venders who had 5 microwaves that has price less than 3500S. 4- Find the phone numbers of venders who sell Televisions. 5- Delete the records of venders who their first name is 'smith'

Answers

Explanation:

answer me pls i need sol bbbd

What’s cloud-based LinkedIn automation?

Answers

Answer:

Cloud based LinkedIn automation includes tools and software that run through the cloud-system and are not detectable by LinkedIn. Cloud based LinkedIn automation tools are becoming the favorite among B2B marketers and sales professionals as they are giving the desired outcomes without any effort.

when was first generation of computer invented? ​

Answers

Introduction: 1946-1959 is the period of first generation computer. J.P.Eckert and J.W. Mauchy invented the first successful electronic computer called ENIAC, ENIAC stands for “Electronic Numeric Integrated And Calculator”.

mk chưa hiểu nên các bạn giúp mk vs

Answers

Answer:

my tab and state it all over my name to

5. Which events is used to code on any form load
a) Form Text b) Form Code c) Form Load d) Form Data

Answers

Answer:

I think b is correct answer

Which is an appropriate strategy for using a workplace blog?

A. Use a professional tone.

B. Use an informal tone in internal blogs.

C. Treat internal blogs as personal communication.

Answers

Answer:

a

Explanation:

An approprbiate strategy for using a workplace blog is to use a professional tone. The correct option is a.

What is a professional tone?

Professional writing is a sort of writing that aims to quickly communicate information and ideas in a professional setting. It is straightforward and succinct. Professional writing aims to inform or persuade a reader about the business and work worlds.

Business writers should aim for an overall tone that is assured, respectful, and sincere; that employs emphasis and subordination effectively; that contains nondiscriminatory language; that emphasizes the "you" attitude.

It is written at a degree of difficulty that is suitable. Internal corporate communications, legal documents, business reports, governmental regulations, and scripts for the entertainment sector are typical examples of professional writing.

Therefore, the correct option is A. Use a professional tone.

To learn more about professional tone, refer to the link:

https://brainly.com/question/1278496

#SPJ2

Describe two types of storage devices?​

Answers

Answer:

Central Process Unit and Random Access Memory

What does the statement that follows do? double gallons[6] = { 12.75, 14.87 }; a. It assigns the two values in the initialization list to the first two elements but leaves the other elements with the values currently in memory. b. It assigns the two values in the initialization list to the first and second elements, third and fourth elements, and fifth and sixth elements. c. This statement is invalid. d. It assigns the two values in the initialization list to the first two elements and default values to the other elements.

Answers

Answer:

It assigns the two values in the initialization list to the first two elements and default values to the other elements.

Explanation:

Given

The array initialization

Required

Interpret the statement

double gallons[6] implies that the length/size of the array gallons is 6.

In other words, the array will hold 6 elements

{12.75, 14.87} implies that only the first two elements of the array are initialized ; the remain 4 elements will be set to default 0.

Write a program that asks the user to enter in a username and then examines that username to make sure it complies with the rules above. Here's a sample running of the program - note that you want to keep prompting the user until they supply you with a valid username:

Answers

user_in = input ("Please enter your username: " )

if user_in in "0123456789":

print ("Username cannot contain numbers")

elif user_in in "?":

print ("Username cannot continue special character")

else:

print (" Welcome to your ghetto, {0}! ".format(user_in))

Why is it useful for students to practice the MLA and APA citation methods?

Answers

Answer:

Citing or documenting the sources used in your research serves three purposes:

It gives proper credit to the authors of the words or ideas that you incorporated into your paper.

It allows those who are reading your work to locate your sources, in order to learn more about the ideas that you include in your paper.

what is the main difference between a computer program and computer software​

Answers

Answer:

Think of computer software sort of as DNA, because DNA is the human body's computer software. And a computer program is like an activity your body does.

Explanation:

Sorry if this didn't help.

10. Which property is used to show the form in maximize state
a) Selection State b) Window State c) Mode d) Opening State

Answers

Answer:

windows state

Explanation:

the answer is windows state.

The analog computer deals directly with

Answers

continuously variable aspects of physical phenomena such as a electrical, mechanical etc.

The analog computer deals directly with measured values of continuous physical magnitude.

What is an Analog computer?

An analog computer may be defined as a type of computer that is significantly used to process analog data. These computers store data as a continuum of physical quantities and perform calculations using measurements.

It is completely different from digital computers, which use symbolic numbers to represent results. are great for situations that require data to be measured directly without conversion to numbers or codes. Analog computers, although readily available and used in scientific and industrial applications such as control systems and aircraft, have largely been superseded by digital computers due to the many complications involved.

Therefore, the analog computer deals directly with measured values of continuous physical magnitude.

To learn more about Analog computers, refer to the link:

https://brainly.com/question/18943642

#SPJ2

Your question seems incomplete. The most probable complete question is as follows:

The analog computer deals directly with:

number or codes.measured values of continuous physical magnitude.signals in the form of 0 or 1.signals in discrete values from 0 to 9

Code Example 4-1 int limit = 0; for (int i = 10; i >= limit; i -= 2) { for (int j = i; j <= 1; ++j) { cout << "In inner for loop" << endl; } cout << "In outer for loop" << endl; } (Refer to Code Example 4-1.) How many times does "In inner for loop" print to the console? a. 1 b. 0 c. 2 d. 5 e. 7

Answers

Answer:

"In inner for loop" is printed twice.

Answer: C. 2

Explanation:

Code:

int main()

{

   int limit = 0;

   for  (int i =0; i>=limit; i-=2) {

       for (int j = i; j <= 1; ++j){

           cout << "In inner for loop" << endl;

       }

       cout << "In outer for loop" << endl;

   }

   return 0;

}

Output:

In inner for loop

In inner for loop

In outer for loop

The output "In inner for loop" print twice.

Thus, option (c) is correct.

In the given code example, the inner for loop has a condition j <= 1.

This condition means that the loop will execute as long as j is less than or equal to 1.

However, the initial value of j is i, and the value of i decreases by 2 in each iteration of the outer for loop.

When i = 8, the inner loop has the condition j ≤ 1.

The loop will iterate as long as j is less than or equal to 1.

So the inner loop executes twice: once when j = 8, and then when j = 9. The statement "In inner for loop" prints twice.

Therefore, the output print twice.

Thus, option (c) is correct.

Learn more about Output problem here:

https://brainly.com/question/33184382

#SPJ4

Other Questions
find the nth term 16,25,36,49 factor effecting rainfall Define ethics and law and show how they are different and similar. Tm GTLN v GTNN caM=x+2y bit x^2 + 4y^2 Identifying linear pairs and vertical angles Identify the mode of persuasion used in the following quote. With this faith we will be able to work together, to pray together, to struggle together, to go to jail together, to stand up for freedom together, knowing that we will be free one day A) logos B) pathos C) ethos What 2/3 as a percentage TOO, ENOUGH, and NOT ENOUGH1. Complete the sentences with too / enough / not ... enough. Example: We didnt have enough money to go to the opera. It was too expensive.(expensive)1. It was too cold to visit the caves. It was ____________________________ (warm).2. We had enough time to visit the castle, but it was __________________________ (crowded).3. Six people wanted to go to the museum. Luckily, Carlas car was _________________ (big).4. I wanted to go to the opera, but I didnt have ________________________ (money).5. The reef is not safe for the children. Its ___________________________ (dangerous) write fifty and two hundreds eight thousandths as a mixed decimal During its first year of operations, the McCormick Company incurred the following manufacturing costs: Direct materials, $4 per unit, Direct labor, $2 per unit, Variable overhead, $3 per unit, and Fixed overhead, $160,000. The company produced 20,000 units, and sold 15,000 units, leaving 5,000 units in inventory at year-end. What is the value of ending inventory under absorption costing Record the following selected transactions for January in a twocolumn journal. Once you have completed that, answer questions 1 5 related to your work. (a) Earned $7,000 fees; customer will pay later.(b) Purchased equipment for $45,000, paying $20,000 in cash and the remainder on credit(c) Paid $3,000 for rent for January.(d) Purchased $2,500 of supplies on account.(e) A. Allen $1,000 investment in the company.(f) Received $7,000 in cash for fees earned previously.(g) Paid $1,200 to creditors on account.(h) Paid wages of $6,250.(i) Received $7,150 from customers on account.(j) A. Allen withdrawal of $1,750.2. For part (h), which two accounts are affected?Question 2 options:Fees Earned and CashWages Expense and CashAccounts Payable and CashRent Expense and Cash permanent bodies that are established by the rules of each chamber and that continue from session to session. committees that handle issues that the most important committees in Congress do not consider. committees that work with counterparts in the other house of Congress. committees that reconcile differences in an action. committees inside committees, which handle tasks that the main committee has no time for. A manufacturer of computer memory chips produces chips in lots of 1000. If nothing has gone wrong in the manufacturing process, at most 7 chips each lot would be defective, but if something does go wrong, there could be far more defective chips. If something goes wrong with a given lot, they discard the entire lot. It would be prohibitively expensive to test every chip in every lot, so they want to make the decision of whether or not to discard a given lot on the basis of the number of defective chips in a simple random sample. They decide they can afford to test 100 chips from each lot. You are hired as their statistician.There is a tradeoff between the cost of eroneously discarding a good lot, and the cost of warranty claims if a bad lot is sold. The next few problems refer to this scenario.Problem 8. (Continues previous problem.) A type I error occurs if (Q12)Problem 9. (Continues previous problem.) A type II error occurs if (Q13)Problem 10. (Continues previous problem.) Under the null hypothesis, the number of defective chips in a simple random sample of size 100 has a (Q14) distribution, with parameters (Q15)Problem 11. (Continues previous problem.) To have a chance of at most 2% of discarding a lot given that the lot is good, the test should reject if the number of defectives in the sample of size 100 is greater than or equal to (Q16)Problem 12. (Continues previous problem.) In that case, the chance of rejecting the lot if it really has 50 defective chips is (Q17)Problem 13. (Continues previous problem.) In the long run, the fraction of lots with 7 defectives that will get discarded erroneously by this test is (Q18)Problem 14. (Continues previous problem.) The smallest number of defectives in the lot for which this test has at least a 98% chance of correctly detecting that the lot was bad is (Q19)(Continues previous problem.) Suppose that whether or not a lot is good is random, that the long-run fraction of lots that are good is 95%, and that whether each lot is good is independent of whether any other lot or lots are good. Assume that the sample drawn from a lot is independent of whether the lot is good or bad. To simplify the problem even more, assume that good lots contain exactly 7 defective chips, and that bad lots contain exactly 50 defective chips.Problem 15. (Continues previous problem.) The number of lots the manufacturer has to produce to get one good lot that is not rejected by the test has a (Q20) distribution, with parameters (Q21)Problem 16. (Continues previous problem.) The expected number of lots the manufacturer must make to get one good lot that is not rejected by the test is (Q22)Problem 17. (Continues previous problem.) With this test and this mix of good and bad lots, among the lots that pass the test, the long-run fraction of lots that are actually bad is (Q23) In Drosophila melanogaster the recessive alleles for brown and scarlet eyes (of two independent genes) produce a novel phenotype so that bw/bw;st/st is white. If a pure-breeding brown is crossed to a pure-breeding scarlet, what proportion of the F2 will be white please help asap, see attached photo. This is due in 1 hour!!! please answer both questions. Both 5 and 6 critically discuss the rise of Afrikaaner Nationalism in SA Specific heat capacity is _____.greater for metal than for woodthe amount of heat required to raise the temperature of 1g of a substance 1 oCrepresented by the symbol, Qall of these dimensionsThe Earth has height, width, and depth. This means that it exists inA fourB. threeC. twoD. onePlease select the best answer from the choices providedABCD PLEASE HELP WILL GIVE BRAINLIESTDo not copy off of others answer How did Theodore Roosevelts foreign policy philosophy benefit the United States? We need your help, not your money. It 2. The party will be held at that luxury restaurant. It is at 3. She needs 10 days to solve that difficult problem. It is 10 days4. He took a lot of photos on his vacation. It was on5. It was Mr. Johnson that every student respected to. It was6. People use English all over the world use. It is English 7. The thick fog prevented Nam from going to work. It was Nam 8. The countryside is most beautiful in autumn. It is in autumn