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
GalinKa [24]
3 years ago
6

According to programming best practices, how should you handle code that needs to be repeated several times in a program?

Computers and Technology
1 answer:
ahrayia [7]3 years ago
8 0

Explanation:

Copy the code as many times as needed so that each usage is separate.

You might be interested in
Drag the correct type of update to its definition.
Sophie [7]

Answer:

  • PRI

The connection between a mobile device and radio tower.

  • Baseband

The chip that control the radio frequency waves within a device.

  • PRL

A list of radio frequencies.

Baseband can be defined as a  technology within the the mobile devices that creates and manages interface to wireless network such as radio transmitters and the radio receivers.

Primary Rate Interference PRI on the other hand is a connection that is configured by many countries. This configuration has specified data and control channels with specified speed for specified countries depending upon the T-carriers and E-carriers.

3 0
2 years ago
Why should spain go to Africa ​
uysha [10]

Answer:

to learn about their cultural heritage and historical significance

3 0
3 years ago
Problem 1: you must write a method for this problem called sentenceAnalyzer Write a program that reads a sentence from the keybo
forsale [732]

Answer:

   static void sentenceAnalyzer(String sentence){

       int lenOfString = sentence.length()-1;

   

           if(sentence.charAt(lenOfString)=='.'){

               System.out.println("Declarative");

             

           }

           else   if(sentence.charAt(lenOfString)=='?'){

               System.out.println("Interrogative");

             

           }

           else if(sentence.charAt(lenOfString)=='!'){

               System.out.println("Exclamation");

             

           }

           else{

               System.out.println("Unknown");

             

           }

   

   }

Explanation:

Using Java programming language

Create the method as required

Obtain the index of the last element using the string length method

Use if and else statements to check if the character at the last index is equal to any of the characters given and print the expected output

see a complete code with the main method below

<em>import java.util.Scanner;</em>

<em>public class num11 {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner(System.in);</em>

<em>        //Receiving User input</em>

<em>        System.out.println("Enter a sentence");</em>

<em>        String sentence = in.nextLine();</em>

<em>        // Calling the method</em>

<em>        sentenceAnalyzer(sentence);</em>

<em>    }</em>

<em>    static void sentenceAnalyzer(String sentence){</em>

<em>        int lenOfString = sentence.length()-1;</em>

<em />

<em>            if(sentence.charAt(lenOfString)=='.'){</em>

<em>                System.out.println("Declarative");</em>

<em>            }</em>

<em>            else   if(sentence.charAt(lenOfString)=='?'){</em>

<em>                System.out.println("Interrogative");</em>

<em>            }</em>

<em>            else if(sentence.charAt(lenOfString)=='!'){</em>

<em>                System.out.println("Exclamation");</em>

<em>            }</em>

<em>            else{</em>

<em>                System.out.println("Unknown");</em>

<em>            }</em>

<em>    }</em>

<em>}</em>

<em />

8 0
3 years ago
What is the best option for sharing Word documents on a Microsoft network because it provides finer degrees of versioning contro
babymother [125]

Answer:

SharePoint Server

Explanation:

One drive you are not being provided with the opportunities like the versioning, check-outs and content approval. However, through SharePoint Server, you are being leveraged with all these features. Through versioning, you can update the document anytime, and also keep track of previous versions as well as the changes that you are making. Through content approval, you can ensure various members have approved permission privilege with them regarding the publication of the content.

Through checkout and check-ins the users can have control ob the new versions of the document as well as while the check-in the document, they can comment on the changes they have made.

6 0
3 years ago
Write a test program that creates two Rectangle objects—one with width 4 and height 40 and the other with width 3.5 and height 3
BARSIC [14]

Answer:

public class Rectangle {

   private double width;

   private double heigth;

   public Rectangle(double width, double heigth) {

       this.width = width;

       this.heigth = heigth;

   }

   public double getWidth() {

       return width;

   }

   public void setWidth(double width) {

       this.width = width;

   }

   public double getHeigth() {

       return heigth;

   }

   public void setHeigth(double heigth) {

       this.heigth = heigth;

   }

   public double perimeter(double width, double heigth){

       double peri = 2*(width+heigth);

       return peri;

   }

   public double area(double width, double heigth){

       double area = width*heigth;

       return  area;

   }

}

class RectangleTest{

   public static void main(String[] args) {

       //Creating two Rectangle objects

       Rectangle rectangle1 = new Rectangle(4,40);

       Rectangle rectangle2 = new Rectangle(3.5, 35.7);

       //Calling methods on the first Rectangel objects

       System.out.println("The Height of Rectangle 1 is: "+rectangle1.getHeigth());

       System.out.println("The Width of Rectangle 1 is: "+rectangle1.getWidth());

       System.out.println("The Perimeter of Rectangle 1 is: "+rectangle1.perimeter(4,40));

       System.out.println("The Area of Rectangle 1 is: "+rectangle1.area(4,40));

       // Second Rectangle object

       System.out.println("The Height of Rectangle 2 is: "+rectangle2.getHeigth());

       System.out.println("The Width of Rectangle 2 is: "+rectangle2.getWidth());

       System.out.println("The Perimeter of Rectangle 2 is: "+rectangle2.perimeter(4,40));

       System.out.println("The Area of Rectangle 2 is: "+rectangle2.area(4,40));

   }

}

Explanation:

  • Firstly A Rectangle class is created with two fields for width and heigth, a constructor and getters and setters the class also has methods for finding area and perimeters
  • Then a RectangleTest class containing a main method is created and two Rectangle objects are created (Follow teh comments in the code)
  • Methods to get height, width, area and perimeter are called on each rectangle object to print the appropriate value
5 0
2 years ago
Other questions:
  • Schools are businesses that need to install software on a large number of computers can usually obtain a ______
    13·1 answer
  • Match each invention with its effects on the age of exploration.
    6·2 answers
  • ____ is the only automated disk-to-disk tool that allows you to copy data to a slightly smaller target drive than the original s
    5·1 answer
  • Which of the following is NOT a valid name for a function?
    5·1 answer
  • For this assignment, you will write a program that calculates gross and net revenue for a movie theater. Consider the following
    15·1 answer
  • What are registers in ICT used for?
    5·1 answer
  • The first commercially available digital camera was which of the following?
    9·1 answer
  • Write a Java program that creates a two-dimensional array of type integer of size x by y (x and y must be entered by the user).
    7·1 answer
  • Read the scenario and then answer the question using only the information provided.
    7·1 answer
  • Difference between automated testing and manual testing
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!