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
miskamm [114]
4 years ago
5

What will this method call print to the screen? public void funWithNumbers(double myDouble) { int myInt = (int) myDouble; String

myString = ""; while(myInt != 0) { myString = myInt % 10 + myString; myInt /= 10; } System.out.println(myString); } funWithNumbers(314159)
Computers and Technology
1 answer:
marshall27 [118]4 years ago
6 0

Answer:

A string of "314159"

Explanation:

Given the code as follows:

  1.    public static void main(String[] args) {
  2.        funWithNumbers(314159);
  3.    }
  4.    public static void funWithNumbers(double myDouble) {
  5.        int myInt = (int) myDouble;
  6.        String myString = "";
  7.        while(myInt != 0)
  8.        {
  9.            myString = myInt % 10 + myString;
  10.            myInt /= 10;
  11.        }
  12.        System.out.println(myString);
  13.    }

This function will convert an input number to an equivalent string. For example, input: 314159   output: "314159"  

Within the function<em> funWithNumbers()</em>, each of the individual digit will be taken from the right. This can be achieved by using modulus operator ,%, to get remainder of the input number divided by 10 (Line 11). The remainder is joined with a string, <em>myString</em>.

To get the subsequent digits from the right, divide the input number by 10 (Line 12) and repeat the same process to extract the digit one by one using modulus operator and concatenate it with <em>myString </em>within the while loop.

Upon completion of the while loop, a string version of the input number will be generated and printed out to terminal (Line 14).

You might be interested in
All of the following are search operators EXCEPT _______________. a. AND b. OR c. NOT d. GET
ella [17]
D is ur answer. Hope this helps
5 0
4 years ago
Read 2 more answers
Create an Entity-Relationship Diagram with the following requirements.
melamori03 [73]

Answer:

idk

Explanation:

6 0
3 years ago
Which of the three is not a popular cloud suite or online office suite?
SIZIF [17.4K]
C. Thinksmart - thinksmart only sells products and softwares of their own. Thinksmart is a online selling company that sells moslty softwares on their domain. Think smart is not a popular cloud suite or an online office suite. So the answer to your question is C.
3 0
4 years ago
1. Write programming code in C++ for school-based grading system. The program should accept the Subject and the number of studen
satela [25.4K]

In this program, I am using the school-based grading system and the program should accept the subject and the number of students.

Program approach:-

  • Using the necessary header file.
  • Using the standard I/O namespace function.
  • Define the main function.
  • Declare the variable.
  • Display enter obtain marks in 5 subjects.
  • Return the value.

Program:-

//header file

#include<iostream>

//using namespace

using namespace std;

//main method

int main()

{

//declare variable

  int j;

  float mark, sum=0, a;

//display enter obtain marks in 5 subjects

  cout<<"Enter Marks obtained in 5 Subjects: ";

  for(j=0; j<5; j++)

  {

      cin>>mark;

      sum = sum+mark;

  }

  a = sum/5;

//display grade

  cout<<"\nGrade = ";

  if(a>=91 && a<=100)

//display a1

      cout<<"a1";

  else if(a>=81 && a<91)

//display a2

      cout<<"a2";

  else if(a>=71 && a<81)

      cout<<"b1";

  else if(a>=61 && a<71)

      cout<<"b2";

  else if(a>=51 && a<61)

//display c1

      cout<<"c1";

  else if(a>=41 && a<51)

//display c2

      cout<<"c2";

  else if(a>=33 && a<41)

//display d

      cout<<"d";

  else if(a>=21 && a<33)

//display e1

      cout<<"e1";

  else if(a>=0 && a<21)

//display e2

      cout<<"e2";

  else

//display invalid

      cout<<"Invalid!";

  cout<<endl;

//return the value

  return 0;

}

Learn more grading system

brainly.com/question/24298916

7 0
3 years ago
Given two integers low and high representing a range, return the sum of the integers in that range. For example, if low is 12 an
Vaselesa [24]

       System.out.println(sumRange(12, 18)); // prints 105

       System.out.println(sumRange(18, 12)); // prints 0

       System.out.println(sumRange(18, 18)); // prints 18

   }

   public static int sumRange(int low, int high)

   {

       int sum = 0;

       for (int val = low; val <= high; val++){

           sum += val;

       }

       return sum;

   }

}

8 0
3 years ago
Other questions:
  • Which statement accurately describes the clutter feature in outlook 2016
    12·1 answer
  • python Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that ho
    10·1 answer
  • Which statement identifies what the students will be graded on?
    5·2 answers
  • Whoevr answers this will be marked brainliest
    12·1 answer
  • Which option describes the purpose of configuring native supplicant profile on the cisco ise?
    7·1 answer
  • Answer the following questions:
    7·1 answer
  • Are goals that<br> have concrete criteria for measuring<br> progress toward their attainment.
    5·1 answer
  • A switch has just arrived from Cisco. The switch has never been configured with any VLANs, but VTP has been disabled. An enginee
    13·1 answer
  • What is computer graphics uses of computer graphics​
    14·1 answer
  • Jacob was sitting in class. His teacher understands that he is the type of student that doesn't comprehend when he sees or hears
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!