1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lesya [120]
2 years ago
12

Please Tell Me How To Code This

Computers and Technology
1 answer:
bulgar [2K]2 years ago
4 0

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:

brainly.com/question/15520075

You might be interested in
3.<br>What is the meaning of *.VBP.<br>​
Kisachek [45]

Answer:

The meaning of VBP is Visual Basic Project

7 0
3 years ago
Read 2 more answers
Cycle technology implemented a dibs initiative last year for one of the manufacturing sites. however, the initiative is not prog
shtirl [24]
  • A possible reason the DIBS initiative is not developing as planned is that the company keeps DIB separate from day-to-day operations. DIB must be part of the ecosystem in running the company and not separate.

  • A manufacturing process is the method a business will follow to make the product. The type of manufacturing you can use is determined by several factors such as the market demand for products, the state of raw materials, and the availability of resources and the state of your factory. The manufacturing techniques are all different and have their respective advantages if used in accordance with Standard Operating Procedures and of course also have disadvantages for each manufacturing technique.

Learn more about Manufacturing Process here brainly.com/question/28384697

#SPJ1

5 0
2 years ago
Given that the input A is false, the input B is false, and the input C is true, what is the resulting value of the output?
Debora [2.8K]

Answer:

out put is false

Explanation:

I hope it's helpful

6 0
2 years ago
Which term best describe the operating system of a computer?
blsea [12.9K]

Answer:

Explanation:

System Software

6 0
3 years ago
Write a 2-to-3-page research paper describing in plain language the basic purpose, theory, and implementation of GUI application
laila [671]

Answer:

       

Explanation:

4 0
3 years ago
Other questions:
  • What is heaven backwards?
    11·2 answers
  • What is a programming language?
    11·2 answers
  • A RAID structure ____. is primarily used for security reasons is primarily used to ensure higher data reliability stands for red
    14·1 answer
  • If you have created a document that contains a table that is 10 inches wide and 4 inches high, you will want to print the docume
    6·2 answers
  • Can someone please help me on these short short questions marking Brainly computer modeling people please help
    14·1 answer
  • Explain the four misconceptions about entrepreneurship.
    7·1 answer
  • Basic python coding, What is the output of this program? Assume the user enters 2, 5, and 10.
    8·1 answer
  • Jettison folk 2007, Magnum opus, be moving, offers poisoned commentary on the film industry.
    7·1 answer
  • What facilitates the automation and management of business processes and controls the movement of work through the business proc
    9·1 answer
  • A market-product strategy that requires no change in the basic product but instead seeks new buyers is known as ______
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!