Write a java program that use multiple arrays This is a simple array program which does not use an "external class & demo program" If you wish, you may break it down into methods, but that is not required. a. Set up 4 arrays which hold data about 6 items you want to sell: [make them up] int[ ] itemnum int[ ] quantity double[ ] price double[ ] sales b. Set up loops to load the itemnum, quantity and price arrays c. Set up another loop to calculate values for the sales array. [= price * quantity] d. Set up another loop to print the item number and sales amount for each transaction . e. Set up another loop to calculate the total sales of all 6 items f. print the total sales amount

Answers

Answer 1
Answer:

Answer:

Explanation:

import java.util.Array;

public class Items{

public static void main (String {} args){

// a. Set up 4 arrays which hold data about 6 items you want to sell

int [] itemnum = new int[](1,2,3,4,5,6);

int [] quantity = new int[](500,200,350,100,270,300);

double [] price = new double [](10000, 50000,30000, 22000, 26000,100200);

double[] sales = new double [6];

//b. Set up loops to load the itemnum, quantity and price arrays

for(int I=0;I<6;I++)

{

System.out.println("Item "+itemnum[I]);

System.out.println("Item "+quantity[I]);

System.out.println("Item "+price[I]);

}

//c. Set up another loop to calculate values for the sales array.

for(int j=0;j<6;j++)

{

sales[j] = quantity[j] * price[j];

}

//d. Set up another loop to print the item number and sales amount for each transaction

for(int k=0;k<6;k++)

{

System.out.println("Item Number "+itemnum[k]);

System.out.println("Sales Amount "sales[k]);

}

//e. Set up another loop to calculate the total sales of all 6 items

double totalsales = 0;

for(int l=0;l<6;l++)

{

totalsales+=sales[l];

}

//f. print the total sales amount

System.out.print("Total Sales: "+totalsales);

}

}


Related Questions

Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by " seconds". End with a newline.
_________ help(s) prevent a person from being a single point of failure.
What is the use of form in HTML​
What is the main purpose of the status report? O A. To ensure that management and the team has a clear picture of the state of the project. B. To alert management to exceptional or unusual situations, C. To document the impact of change requests from the client. D. To detail the mistakes made in planning and budgeting,​
Kara's teacher asked her to create a chart with horizontal bars. Which chart or graph should she use?Bar graphColumn chartLine graphPie chart

What error can you identify? (Points : 4)A double quotation mark was incorrectly inserted.
You cannot compare apples to oranges.
Assumes indentation has a logical purpose
No error

Answers

Answer:

Assumes indentation has a logical purpose

Explanation:

No period

Use the drop-down menus to complete the steps for inserting a range of cells in a worksheet.1. Click the first cell to select, and then drag to the last cell to select.

2. Click the
tab.

3. In the
group, click
.

4. Specify whether to shift cells or insert an entire row or column, and click OK.

Answers

The completion of steps for inserting a range of cells in a worksheet as follows:

  • Click the first cell to select the first cell, and then drag to the last cell to select the entire cell.
  • Click the home tab.
  • In the cells group, and then click insert.

What is the advantage of inserting a range of cells in a worksheet?

The advantage of inserting a range of cells in a worksheet is that it generally makes your workbook easier to read, constructing formulas faster to read, and authorizes you to create ranges with variable sizes to produce your dynamic spreadsheet which is easy to update as well.

According to the context of this question, if one should want to insert a range of cells in a spreadsheet, he/she must follow some steps in order to make it effective, convenient, and dynamic.

Therefore, the completed steps for inserting a range of cells in a worksheet are well described above.

To learn more about Spreadsheet, refer to the link:

brainly.com/question/25879801

#SPJ5

Answer:

Click the  Home  tab. In the Cells group, click  Insert

Explanation:

I had it on a quiz.

Checkpoint 10.43 Write an interface named Nameable that specifies the following methods: _______{ public void setName(String n) public String getName()} Fill in the blank.

Answers

Answer:

Fill the blank with

public interface Nameable {

Explanation:

Required

Complete code segment with the interface definition

The given code segment is divided into three parts

1. The interface

2. The method that returns nothing

3. The method that returns string

The blank will be filled with the definition of the interface.

The definition is as follows:

public interface Nameable {

Analyzing the above definition

public -----> This represents the modifier

interface ------> This represents that the definition is an interface

Nameable ------> This represents the name of the interface

The ____ area on the status bar includes six commands as well as the result of the associated calculation on the right side of the menu.

Answers

Auto Calculate 

The 
Auto Calculate area on the status bar includes six commands as well as the result of the associated calculation on the right side of the menu.

Hope This Helps :)

P.S
If you would make me as brainiest that would be great! :D 

Consider the following definition of a recursive method. public static int mystery(int[] list, int first, int last) { if (first == last) return list[first]; else return list[first] + mystery(list, first + 1, last); } Given the declaration int[] alpha = {1, 4, 5, 8, 9}; What is the output of the following statement? System.out.println(mystery(alpha, 0, 4)); a. 1 b. 18 c. 27 d. 32

Answers

Answer:

c. 27

Explanation:

  • In recursion method, a method calls itself until a condition becomes true and returned back. In mystery(), at first time, first is 0 and last is 4. Condition is checked and 0!=4 so else part is executed in which again mystery is called with first as 1 and last 4. This will go again and again until first=4.
  • When first=4 it is also equal to last so if part is executed and alpha[4] is returned which is 9, now it comes alpha[3] +9 which is 8+9 =17 .
  • It is returning values to its previous calls that is why it will reduce to alpha[0]+alpha[1]+alpha[2]+17 which is nothing but sum of all elements of a alpha
  • Then, 1+4+5+8+9=27.

Originally, Java was used to create similar apps as what other language?Perl
Python
CSS
Javascript

Answers

Originally, Java was used to create similar apps as other languages, which as python. The correct option is b.

What are computer languages?

The computer languages are Java and Python is in their conversion; the Java compiler converts Java source code into an intermediate code known as bytecode, whereas the Python interpreter converts Python source code into machine code line by line.

Curly braces are used in Java to define the beginning and end of each function and class definition, whereas indentation is used in Python to separate code into separate blocks.

Multiple inheritances is done partially through interfaces in Java, whereas Python continues to support both solitary and multiple inheritances.

Therefore, the correct option is b. Python.

To learn more about computer languages, refer to the below link:

brainly.com/question/14523217

#SPJ2

Answer:

Python

Explanation:

Took the test

Other Questions