Write a pseudocode for the following java programs:
public class Item {
private String name;
private double cost;
public Item(String name, double cost) {
this.name = name;
this.cost = cost;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
}
public enum PaymentType {
CASH,
DEBIT_CARD,
CREDIT_CARD,
CHECK
}
/*every payment has a type and an amount*/
public class Payment {
private double amount;
private PaymentType paymentType;
public Payment(double amount, PaymentType paymentType)
{
this.amount = amount;
this.paymentType =
paymentType;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public PaymentType getPaymentType() {
return paymentType;
}
public void setPaymentType(PaymentType paymentType)
{
this.paymentType =
paymentType;
}
Pseudocode for the first Java Program.
1. Begin
2. Declare a public class Item withtwo private member variables name and cost.
3. Define a constructor for Class Item.
4. Define getter and setter methods for getting and setting member variables name and cost.
5. End.
Pseudocode for the second Java Program.
1. Begin
2. Define an enumerated data type called PaymentType with
options CASH, DEBIT_CARD, CREDIT_CARD and CHECK
3. Declare a public class Payment with two private member variables
amount and paymentType.
4. Define a constructor for class Payment.
5. Define getter and setter methods for getting and setting member variables amount and paymentType.
6. End
Get Answers For Free
Most questions answered within 1 hours.