Answer :
The program is an illustration of string manipulations.
String manipulation involves splitting and replacing characters of a string.
The program in Java, where comments are used to explain each line is as follows:
import java.util.*;
public class Main{
public static void main(String[] args) {
//The next two lines declare all variables, as strings and double
String ddate,desc;
double weight, price;
//This creates a scanner object
Scanner input = new Scanner(System.in);
//This prompts the user for date, and also gets its input
System.out.print("Date (MM/DD/YY): "); ddate = input.nextLine();
//This prompts the user for item description, and also gets its input
System.out.print("Description: "); desc = input.nextLine();
//This prompts the user for price per pound, and also gets its input
System.out.print("Price per pound: "); price = input.nextDouble();
//This prompts the user for weight, and also gets its input
System.out.print("Weight: "); weight = input.nextDouble();
//This replaces all slashes (/) in the date by dash (-)
ddate = ddate.replace("/", "-");
//This prints the first three characters of the item description
System.out.println("Description: "+desc.substring(0, 3));
//This prints the date
System.out.println("Date: "+ddate);
//This prints the item price per pound
System.out.println("Price per pound: "+price);
//This prints the item weight
System.out.println("Weight: "+weight);
//This prints the total price of the item
System.out.println("Total: "+(weight*price));
}
}
At the end of the program, all user inputs are printed
See attachment for sample run.
Read more about similar programs at:
https://brainly.com/question/15520075
