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
satela [25.4K]
2 years ago
15

Multiply each element in origList with the corresponding value in offsetAmount. Print each product followed by a semicolon (no s

paces). Ex: If the input is: 4 5 10 12 2 4 7 3 the output is: 8; 20;70; 36; 1 #include 2 3 int main(void) { 4 const int NUM_VALS = 4; 5 int origList[NUM_VALS]; 6 int offsetAmount [NUM_VALS]; 7 int i; 8 9 scanf("%d", &origList[0]); 10 scanf("%d", &origList[1]); 11 scanf("%d", &origList[2]); 12 scanf("%d", &origList[3]); 13 14 scanf("%d", &offsetAmount[0]); 15 scanf("%d", &offsetAmount[1]); 16 scanf("%d", &offsetAmount[2]); 17 scanf("%d", &offsetAmount[3]); 18 19 \* Your code goes here */ 20 21 printf("\n"); 22 23 return 0; 24
Computers and Technology
1 answer:
oee [108]2 years ago
5 0

Answer:

Replace /* Your code goes here */  with

for(i =0; i<NUM_VALS; i++) {

    printf("%d", origList[i]*offsetAmount[i]);

printf(";");

}

Explanation:

The first line is an iteration statement iterates from 0 till the last element in origList and offsetAmount

for(i =0; i<NUM_VALS; i++) {

This line calculates and print the product of element in origList and its corresponding element in offsetAmount

    printf("%d", origList[i]*offsetAmount[i]);

This line prints a semicolon after the product has been calculated and printed

printf(";");

Iteration ends here

}

You might be interested in
What type of software is responsible for managing processor time and memory allocation?
yKpoI14uk [10]

Answer: Operating system

Explanation:

 The operating system is the type of software that are responsible for manage the processor time and also the memory allocation in the system. The operating system mainly deals with the processor time by scheduling the processor work done in the system.

The OS mainly control the system and then schedule the execution of various types of function by the central processing system (CPU). It also control the memory allocation in the system.

4 0
3 years ago
In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends deci
pickupchik [31]

Answer:

The java program for the given scenario is as follows.

import java.util.*;

import java.lang.*;

public class Main

{

   //variables for bill and tip declared and initialized

   static double bill=47.28, tip=0.15;

   //variables for total bill and share declared

   static double total, share1;

public static void main(String[] args) {

    double total_tip= (bill*tip);

    //total bill computed

    total = bill + total_tip;

    //share of each friend computed

    share1 = total/2;

    System.out.printf("Each person needs to pay: $%.2f", share1);  

}

}

Explanation:

1. The variables to hold the bill and tip percent are declared as double and initialized with the given values.

static double bill=47.28, tip=0.15;

2. The variables to hold the values of total bill amount and total tip are declared as double.

3. All the variables are declared outside main() and at class level, hence declared as static.

4. Inside main(), the values of total tip, total bill and share of each person are computed as shown.

double total_tip= (bill*tip);

total = bill + total_tip;

share1 = total/2;

5. The share of each person is displayed to the user. The value is displayed with only two decimal places which is assured by %.2f format modifier. The number of decimal places required can be changed by changing the number, i.e. 2. This format is used with printf() and not with println() method.

System.out.printf("Each person needs to pay: $%.2f", share1);  

6. The program is not designed to take any user input.

7. The program can be tested for any value of bill and tip percent.

8. The whole code is put inside a class since java is a purely object-oriented language.

9. Only variables can be declared outside method, the logic is put inside a method in a purely object-oriented language.

10. As shown, the logic is put inside the main() method and only variables are declared outside the method.

11. Due to simplicity, the program consists of only one class.

12. The output is attached.

5 0
3 years ago
Read 2 more answers
In unreal engines which class should be used to define the rules of the game
mel-nik [20]

Answer: The number of players and spectators present, as well as the maximum number of players and spectators allowed.

Explanation: players

8 0
3 years ago
In three to four sentences, describe why CEOs (the chief executive officers, that is, the leaders of large companies) make very
mixer [17]
Well, CEOs are on the top of the food chain. It takes a lot of work and ambition to become one, and once they are one, <span>CEOs accept a huge amount of responsibility - that means having to take blame if things go wrong and </span><span>having more tasks to complete such as having to attend numerous meetings, make decisions. They are also on the board of directors.</span>

Assistants do not have to do as much, they likely won't have that much responsibility or experience, their tasks revolve around ensuring meetings are scheduled and performing other ad-hoc duties.
5 0
3 years ago
Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Per
SSSSS [86.1K]

Answer:

Person p1, p2, p3;

int m1, m2, m3;

p1 = new Person();

// assignment 1

m1 = p1.getMoney();

p2 = new Student();

// assignment 2

m2 = p2.getMoney();

p3 = new Employee();

// assignment 3

m3 = p3.getMoney();

//////////////////////////////////////////////////////////////////////////////////////////////

The reference to getMoney in assignment 3 is to the <em>Person</em> class.

Explanation:

Since Employee class didn't override Person class's getMoney() method, calling p3 with getMoney() will call Base class's (Person) getMoney() method.

6 0
2 years ago
Other questions:
  • Mobile devices typically come pre installed with standard apps like web browsers , media players, and mapping programs true or f
    9·1 answer
  • All of the language commands that the CPU understand make up the CPU's
    15·1 answer
  • Help please brainliest
    8·1 answer
  • What is the importance of Mathematical Modeling in the field of bioinformatics.
    8·1 answer
  • What was the history of technology since the 1980s to now and how is it used in classrooms?.?. PLEASE HELP
    13·1 answer
  • I need a explanation for this 02 question for a test I will have .
    11·1 answer
  • Which of the following are disadvantages of networks? Check all of the boxes that apply.
    14·1 answer
  • Task 2: Typing a School Speech
    12·1 answer
  • I NEED A BIG BRAIN BOYO TO HELP ME
    14·1 answer
  • A. A set of electronic program that makes of computer perform tasks
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!