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
lapo4ka [179]
3 years ago
14

Given a int variable named calls Received and another int variable named operators On Call write the necessary code to read valu

es into calls Received and operators On Call and print out the number of calls received per operator (integer division with truncation will do).
Computers and Technology
1 answer:
joja [24]3 years ago
4 0

Answer:

import java.util.Scanner;

public class CocaColaVendingTest {

   public static void main(String[] args) {

       Scanner input = new Scanner(System.in);

       System.out.println("Enter the total number of calls received");

       int callsReceived = input.nextInt();

       System.out.println("Enter the total number of operators");

       int operatorsOnCall = input.nextInt();

               int callsPerOperator = callsReceived/operatorsOnCall;

       System.out.println("The number of calls per operator is "+callsPerOperator);

   }

}

Explanation:

A complete Java code is given above. The user is prompted to enter the values for the number of calls received and the number of operators. These are stored in the respective variables.

Using an Integer division, the number of calls per operator is obtained by: callsPerOperator = callsReceived/operatorsOnCall;

You might be interested in
A or an is a simple chip with two or more processor core
Sergio039 [100]
A multi-core processor, i’m pretty sure
5 0
4 years ago
Write a recursive method that tests whether a string is a palindrome. It should return a boolean T or F depending on whether or
Sveta_85 [38]

Answer:

// program in java.

// library

import java.util.*;

// class definition

class Main

{

// recursive function to check palindrome

   public static boolean isPalin(String str){

// base case

     if(str.length() == 0 ||str.length()==1){

        return true;

     }

// if first character is equal to last

     if(str.charAt(0) == str.charAt(str.length()-1))

     {

     // recursive call

        return isPalin(str.substring(1, str.length()-1));

     }

     // return

     return false;

  }

  // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input

Scanner scr=new Scanner(System.in);

System.out.print("Enter a string:");

 // read string from user

String myString =scr.nextLine();

 // call function to check palindrome

     if (isPalin(myString)){

        System.out.println("Given String is a palindrome");

     }

// if string is not palindrome

     else{

        System.out.println("Given String is not a palindrome");

     }    

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read a string from user and assign it to variable "myString" with scanner object. Call the method isPalindrome() with string input parameter.In this method, if  length of string is 0 or 1 then it will return true(base case) otherwise it will call itself and compare first character with last character.If string is palindrome then function will return true else return false.

Output:

Enter a string:ababa                                                                                                      

Given String is a palindrome

8 0
4 years ago
Which of the following does not correctly declare an ArrayList?
kotegsom [21]

Answer:

Option b. ArrayList‹Integer› = new ArrayList‹Integer›(10) does not correctly declare an ArrayList.

<u>Explanation</u>:

ArrayList in Java dynamically stores elements in it. It also called as re- sizeable array as it expands  in size when elements are added and decreases when an element is removed from it. This array list class also allows to use duplicate and null values.

The syntax for creating Array list is as follows

ArrayList<Type> obj = new ArrayList<Type>()

Type  specifies the type of ArrayList like Integer, Character, Boolean etc, and obj is the object name. But in the option b ArrayList‹Integer› = new ArrayList‹Integer›(10)  object name is missed and not specified.

6 0
3 years ago
What are the TV resolutions
Leokris [45]
Numbers like 1080p and 4K refer to a TV's<span> screen </span>resolution and<span> the more pixels a screen has the more picture detail it can show.</span>
6 0
3 years ago
Need help fast this is do a 4
Stells [14]

Answer:

I believe the answer is B.

8 0
3 years ago
Other questions:
  • Distingush between Microkernels andexokernels
    9·1 answer
  • ________ is an open-source program supported by the Apache Foundation that manages thousands of computers and implements MapRedu
    5·1 answer
  • Write an expression whose value is the arithmetic sum of the int associated with x, and the all-digit str associated with s. (hi
    9·1 answer
  • A pair is a simple struct with two data members, one of type T1 and one of type T2. A set and a map are organized as binary sear
    10·1 answer
  • You wish to enter your exam scores in a spreadsheet. Which function will help you find how each subject’s score relates to the o
    15·2 answers
  • A user creates a GPO. What do you need to do for that user to manage his or her GPO that he or she created?
    12·1 answer
  • Help? brainliest and point
    15·1 answer
  • If anyone wants to ft heres the link
    6·1 answer
  • Which key doesn't relate to keyboard A:return key B :enrollment key C: delete key D:tab key
    9·2 answers
  • "Use onblur and onfocus to add red borders to the input elements when the user leaves without any input, and a green border if a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!