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
Luba_88 [7]
3 years ago
12

During execution of main(), how many user-defined methods are called? a) public static double calcTax(double cost) { return cost

* 0.15; } b) public static double calcShippingCost(double weight) { double cost; if(weight < 10) { cost = 10.0; }else{ cost = 15.5; } cost = cost + calcTax(cost); return cost; } c) public static void main(String args[]) { double cost1; double cost2; cost1 = calcShippingCost(7.5); cost2 = calcShippingCost(17.5); }
Computers and Technology
1 answer:
Dovator [93]3 years ago
8 0

Answer:

b) public static double calcShippingCost(double weight) { double cost; if(weight < 10) { cost = 10.0; }else{ cost = 15.5; } cost = cost + calcTax(cost); return cost; }

The method is called twice with arguments 7.5 and 17.5 respectively.

Explanation:

The Java program defines three user methods including the main. In the main, the calShippingCost method is called twice with 7.5 and 17.5 respectively to return double number values to cost1 and cost2.

You might be interested in
In a(n) ____, the programmer uses a programming language (in context free grammar) to tell the computer what to accomplish and h
Mamont248 [21]

A 5GL fifth-generation languages a programming language design to solve given problem without programmer. The user only needs to solve the problem and condition without implementing an algorithm.

Explanation:

First Generation Language

The first generation language is called low- level style because they were used at a superficial level of abstraction. First-generation language referred to as the native language.

Second Generation Language

The second-generation language is also low-level language or assembly language. The second level of language uses the concept of mnemonics for the writing program. Symbolic name are used.

Third Generation Language

The third-generation language overcomes the first and second-generation languages. Third generation language is considered as high- level language because the target is to focus on the logic of the program.

Fourth Generation Language

The language of generation required a lot of time and effort that affect programmers.The fourth-generation was developed to reduce the time, cost, and effort.

Fifth Generation Language

The programming language of this generation focuses on constraints programming. The fifth-generation programming languages are Artificial Intelligence and Artificial Neural Network.

6 0
3 years ago
You have decided to use relative links for your Website's local pages instead of specifying absolute URLs. Your supervisor has a
marin [14]

Answer:

C. The site can be moved from one server to another with minimal disruption.

Explanation:

The perfect reason is the option C.The site can be moved from one server to another with minimal disruption. with relative links you don't need to change the host name for the local page because the browser assumes the address that is in the browser and creates a path relative to it as specified by the file.

4 0
3 years ago
What does the Group feature allow you to do?
notsponge [240]
A it allows you to join a group as a member or to create your own group
6 0
3 years ago
What are the 6 example of computer hardware​
zheka24 [161]

Answer:

Monitor.

Motherboard.

CPU(Microprocessor.

Main memory(RAM)

Expansion cards.

Power supply unit.

Explanation:

7 0
3 years ago
Read 2 more answers
Complete the given C program (prob1.cpp) to read an array of integers, print the array, and find the 2nd largest element in the
labwork [276]

Answer:

#include <stdio.h>

int getElement(int arr[], int size) {

   

   int largest2, largest = 0;

   for(int i=0; i<size; i++)

   {

       if(arr[i] > arr[largest])

       {

           largest = i;

       }

   }

   if(largest != 0)

       largest2 = 0;

   else

       largest2 = size - 1;

   for(int i=0; i<size && i != largest ;i++)

   {

       if(arr[i] > arr[largest2])

           largest2 = i;

   }

   

   return arr[largest2];

}

printArray(int arr[], int size) {

   

   printf("The array is: ");

   for(int i=0; i<size; i++)

   {

       printf("%d ", arr[i]);

   }

   printf("\n");

}

int main()

{

 

   int arr[5] = {30, 20, 5, 10, 24};

   printArray(arr, 5);

   printf("Second largest number is: %d", getElement(arr, 5));

   return 0;

}

Explanation:

Since you did not provide any code, I wrote it from the scratch. I also added the main function for you to check the result.

<em>printArray</em> function basically prints the element of the array

<em>getElement</em> function:

- Declare the two variables to hold the value for largest and second largest

- Inside the first loop, check if there is any number that is greater than largest, if yes, assign it to largest

- Inside the second for loop, check if there is any number that is greater than largest2, if yes, assign it to largest2 (Be aware that the largest we found in the first loop is excluded)

- Return the second largest

* Notice that we were able to apply this solution since the numbers are unique.

5 0
3 years ago
Other questions:
  • The rule of thumb in the wireless industry is that a smartphone uses 4 gigabytes of data per month where ____ percent travels th
    14·2 answers
  • Given that it takes 0.08 ms to travel from one track to the next of a hard drive; that the arm is originally positioned at Track
    6·1 answer
  • All the answers I've got is 0, which seems strange but I'm sure I'm following this algorithm correctly.
    15·1 answer
  • Write a statement to add the key Tesla with value USA to car_makers. Modify the car maker of Fiat to Italy. Sample output for th
    9·1 answer
  • What happens if you never confirm your facebook account?
    8·1 answer
  • PSEUDOCODE PRACTICE!!! NEED HELP IMMEDIATELY!!! FIRST ANSWER GETS BRAINLYEST!!!
    12·1 answer
  • Write a program named SortWords that includes a method named SortAndDisplayWords that accepts any number of words, sorts them in
    10·1 answer
  • List with ecamples five important applications areas of computer today​
    15·1 answer
  • Is there anything I can do to fix my laptop? It is a chrome book and my school provided it. Everything is still working.If anyon
    14·2 answers
  • Given the following word addresses: 3, 180, 43, 2,191, 88, 190, 14, 181, 44, 186, 253
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!