Question
I have to write a Java program that includes a method which displays an itemized receipt by taking in an array of items. That array
I have to write a Java program that includes a method which displays an itemized receipt by taking in an array of items. That array holds the names and prices of the items. For example: the method may be:
receipt(int[] numbers){
}
And the numbers array is basically the id numbers associated with each item.
This is how the displayed receipt should look:
name: price name: price name: price number of items: cost of all items:
I'm struggling because I can format and print out an itemized receipt all day long, but I cannot figure out how I would write a method to display this information rather than printing it out. The main method prints out the method that will display the receipt. And I know in Java you can only have one return statement. I just need help on how to start thinking about building it out.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started