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
Musya8 [376]
3 years ago
13

Either a function’s _________ or its _________ must precede all calls to the function.

Computers and Technology
2 answers:
faltersainse [42]3 years ago
8 0

Answer:

Definition, Prototype

Explanation:

A function prototype is the one who declares return type,function name and parameters in it.

<u>Syntax of function prototype </u>

      returnType functionName(type1 argu1, type2 argu2,...);

Function definition contains the block of code to perform a specific task.

<u>Syntax of function definition</u>

            returnType functionName(type1 argu1, type2 argu2, ...)

          {

             //body of the function

           }

Whenever a function is called, the compiler checks if it's defined or not and control is transferred to function definition.

So,it is necessary to define the return type and parameters of the function.

GrogVix [38]3 years ago
6 0

Answer:

definition , prototype

Explanation: A function's definition and it's prototype must come before a function call otherwise the compiler will throw an error of undefined function whatever is the function name. Defining or giving prototype before the function call.The compiler will get to know that there a function exists with the function name and it will not give an error.

You might be interested in
Animation and transition effects will distract your audience when using a slide show presentation aid. True or false ?
lions [1.4K]
I suspect the answer they're looking for is false. However, as an experienced professional in learning and development, I can tell you that when done right these effects can enhance a presentation.
4 0
2 years ago
Read 2 more answers
Why is iot architecture important?
Harlamova29_29 [7]
They need to make sure your building is easy to move around in. Beyond the building itself, architecture and design can help bring balance to people's lives. ... Well-designed schools create better learning environments. Workplaces with good architecture experience higher productivity.
7 0
3 years ago
A production house needs an operating system that captures, saves, and generates information within a specific time. Which type
bearhunter [10]
Windows and linux are best in my opinion! Linux is not used by many people but a lot of apps can't be used for linux so best is to use windows. But Mac is not bad too. Hope I helped and have a nice day!
4 0
3 years ago
For this lab you will write a class to create a user-defined type called Shapes to represent different shapes, their perimeters
maw [93]
<h2>Answer:</h2>

<u />

========= Shape.java  ===========

//import the Scanner class

import java.util.Scanner;

public class Shape{

   //required fields

  private String shape;

   private double area;

   private double perimeter;

   //default constructor

  public Shape(){

       this.shape = "unknown";

       this.area = 0.0;

       this.perimeter = 0.0;

   }

   //constructor with one parameter

   public Shape(String shape){

       this.setShape(shape);

       this.area = 0.0;

       this.perimeter = 0.0;

   }

   //accessors and mutators

  public void setShape(String shape){

       this.shape = shape;

   }

  public String getShape(){

       return this.shape;

   }

   public double getPerimeter(){

       return this.perimeter;

   }

  public double getArea(){

       return this.area;

   }

  public void setPerimeter(Scanner scr){

       if(this.getShape().equals("circle")){

           System.out.println("Enter the radius of the circle");

           double radius = scr.nextDouble();

           this.perimeter = 2 * 3.142 * radius;

       }

       else if(this.getShape().equals("rectangle")){

           System.out.println("Enter the width");

           double width = scr.nextDouble();

           System.out.println("Enter the height");

           double height = scr.nextDouble();

           this.perimeter = 2 * (width + height);

       }

       else if(this.getShape().equals("square")){

           System.out.println("Enter the height or width");

           double height = scr.nextDouble();

           this.perimeter = 4 * height;

       }

       else if(this.getShape().equals("unknown")){

           System.out.println("You must define a shape first before calculating perimeter");

           this.perimeter = 0.0;

       }

       else {

           System.out.println("You must define a shape first before calculating perimeter");

           this.perimeter = 0.0;

       }

   }

   public void setArea(Scanner scr){

       if(this.getShape().equals("circle")){

           System.out.println("Enter the radius of the circle");

           double radius = scr.nextDouble();

           this.area = 3.142 * radius * radius;

       }

       else if(this.getShape().equals("rectangle")){

           System.out.println("Enter the width");

           double width = scr.nextDouble();

           System.out.println("Enter the height");

           double height = scr.nextDouble();

           this.area = width * height;

       }

       else if(this.getShape().equals("square")){

           System.out.println("Enter the height or width");

           double height = scr.nextDouble();

           this.area = height * height;

       }

       else if(this.getShape().equals("unknown")){

           System.out.println("You must define a shape first before calculating area");

           this.area = 0.0;

       }

       else {

           System.out.println("You must define a shape first before calculating area");

           this.area = 0.0;

       }

   }

   //Own methods

   //1. Method to show the properties of a shape

   public void showProperties(){

       System.out.println();

       System.out.println("The properties of the shape are");

       System.out.println("Shape : " + this.getShape());

       System.out.println("Perimeter : " + this.getPerimeter());

       System.out.println("Area : " + this.getArea());

   

   }

   //2. Method to find and show the difference between the area and perimeter of a shape

   public void getDifference(){

       double diff = this.getArea() - this.getPerimeter();

       System.out.println();

       System.out.println("The difference is " + diff);

   }

}

========= ShapeTest.java  ===========

import java.util.Scanner;

public class ShapeTest {

   public static void main(String [] args){

       Scanner scanner = new Scanner(System.in);

       // create an unknown shape

       Shape shape_unknown = new Shape();

       //get the shape

       System.out.println("The shape is " + shape_unknown.getShape());

       //set the area

       shape_unknown.setArea(scanner);

       //get the area

       System.out.println("The area is " + shape_unknown.getArea());

       //set the perimeter

       shape_unknown.setPerimeter(scanner);

       //get the perimeter

       System.out.println("The perimeter is " + shape_unknown.getPerimeter());

       // create another shape - circle

       Shape shape_circle = new Shape("circle");

       //set the area

       shape_circle.setArea(scanner);

       //get the area

       System.out.println("The area is " + shape_circle.getArea());

       //set the perimeter

       shape_circle.setPerimeter(scanner);

       //get the area

       System.out.println("The perimeter is " + shape_circle.getArea());

       //get the properties

       shape_circle.showProperties();

       //get the difference between area and perimeter

       shape_circle.getDifference();

   }

}

<h2>Sample output:</h2>

The shape is unknown

You must define a shape first before calculating area

The area is 0.0

You must define a shape first before calculating perimeter

The perimeter is 0.0

Enter the radius of the circle

>> 12

The area is 452.448

Enter the radius of the circle

>> 12

The perimeter is 452.448

The properties of the shape are

Shape : circle

Perimeter : 75.408

Area : 452.448

The difference is 377.03999999999996

<h2>Explanation:</h2>

The code above is written in Java. It contains comments explaining important parts of the code. Please go through the code for more explanations. For better formatting, the sample output together with the code files have also been attached to this response.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
57aa40cd91dceaa5454e65fc5d209315.png
5 0
2 years ago
Which if the following is an example of tangible property?
lutik1710 [3]
It may have been a songlyrics
7 0
2 years ago
Other questions:
  • Does any body like animal jam
    11·2 answers
  • Which statement accurately compares the restart at 1 and continue numbering featured of word
    15·2 answers
  • The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected
    14·1 answer
  • What is a ribbon in word
    15·2 answers
  • What will be result of below if statement.
    13·1 answer
  • Which part of project management considers if employees will work at home or in the office?
    10·2 answers
  • A(an)_______is built-in preset calculation. <br>formula <br> function <br>equation <br>AutoSum​
    12·1 answer
  • How do I write this code in java? input "Enter Your Age to Order a Beer"
    11·1 answer
  • Beginning in cell B21, complete the series of substitution values ranging from $35 to $45 in increments of $2.50 vertically down
    5·1 answer
  • How is video compression accomplished?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!