#Receipt/Formatting Assignment

1 messages · Page 1 of 1 (latest)

teal oxide
#

I'm trying to put in a variable into my receipt to output a receipt but it's not working. I'll send pic

hasty parcelBOT
#

This post has been reserved for your question.

Hey @teal oxide! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

teal oxide
#
public class Main {
  public static void main(String []args) {
    System.out.format("%32s\n", "Holiday Grocery");
    System.out.format("%32s", "---------------\n");
    System.out.println();
    System.out.println("Thank you for shopping at our store\n");
    System.out.format("Date \t\t\t%s\n", "Dec.23.2022");
    System.out.format("Location \t\t%s\n", "0016225");
    System.out.format("Address \t\t%s\n", "239 Rudolph Rd");
    System.out.format("\t\t\t\t%s\n", "Toronto, ON");
    System.out.format("\t\t\t\t%s\n\n", "M7Z 2X4");
    System.out.format("Payment: \t\t%s\n", "Credit **** **** **** 1025");
    System.out.println("-----------------------------------------------------------------------------");
    System.out.format("%s\t%s\t%s\t\t\t\t%s\t\t%s\t\t\t\t%s\n", "Items", "Code", "Description", "Qty", "Unit Price", "Price");
    int qty = 12;
    double price = 2.59;
    double priceTotal = qty * price;
    System.out.format("%14s%13s%20.2f", "002601", "Home Orange", qty);
    
    
    
    }
}
#

here is my program

mortal ice
#

wdym by "it's not working"

#

what part of it isn't working

teal oxide
#

The formatting part at the bottom

#

where I try to put a qty in the format

#

the last line of the code

#

sorry for being so vague

mortal ice
#

that really doesn't tell me much

#

how isn't it working

#

what exactly is the issue

obtuse cosmos
#

is it concacetenation?

#

I spelled that right

mortal ice
#

concatenation, and no

hasty parcelBOT
# hasty parcel

Before your post will be closed, would you like to express your gratitude to any of the people who helped you? When you're done, click I'm done here. Close this post!.