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
Harlamova29_29 [7]
3 years ago
15

PLEASE HELP ASAP (answer is needed in Java) 70 POINTS

Computers and Technology
1 answer:
8_murik_8 [283]3 years ago
6 0

import java.util.Scanner;

public class MyClass1 {

   public static void main(String args[]) {

     Scanner scan = new Scanner(System.in);

     int smallest = 0, largest = 0, num, count = 0;

     while (true){

         System.out.println("Enter a number (-1 to quit): ");

         num = scan.nextInt();

         if (num == -1){

             System.exit(0);

         }

         else if (num < 0){

             System.out.println("Please enter a positive number!");

         }

         else{

             if (num > largest){

                 largest = num;

                 

             }

             if (num < smallest || count == 0){

                 smallest = num;

                 count++;

             }

             System.out.println("Smallest # so far: "+smallest);

             System.out.println("Largest # so far: "+largest);

         }

     }

   }

}

I hope this helps! If you have any other questions, I'll do my best to answer them.

You might be interested in
12. Realizar un algoritmo que genere un número aleatorio, el usuario debe adivinar cual es el número generado para esto tendrá 3
skelet666 [1.2K]

Answer:

Explanation:

El siguiente algoritmo esta escrito en Java y genera un numero aleatorio. Despues le pide al usario que intente adivinar el numero. Si el usario adivina correctamente entoces le dice que fue correcto y termina el programa. Si no adivina bien entonces dice Incorrecto y le pide otra adivinanza al usario hasta llegar a la tercera adivinanza y se termina el programa.

import java.util.Random;

import java.util.Scanner;

class Brainly{

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       Random ran = new Random();

       int numero = ran.nextInt(20);

       for (int x = 0; x <= 2; x++) {

           System.out.println("Adivina el numero entre 0 y 20: ");

           int respuesta = in.nextInt();

           if (respuesta == numero) {

               System.out.println("Correcto");

               break;

           } else {

               System.out.println("Incorrecto");

           }

       }

   }

}

3 0
3 years ago
A specific remote device with a fixed IP address must be able to access your computer across the network. It must be able to acc
Softa [21]

IP address as it clearly isn't an application and nor is it a protocol.

6 0
4 years ago
Read 2 more answers
Complete the following function to create a deep-copy on the heap of the argv array. Set the result pointer to point to your arr
irga5000 [103]

Answer:

Following are the code in the C programming Language.

//define function

void duplicate(char*argv, char**result) {

//set and initialize the variable to 0

int c = 0;

//set and initialize the char type pointer variable

char** t = argv;

//set the while loop

while(t){

//increment by 1

c++;

//increment by 1

t++;

}

//set malloc function in the pointer variable

result= malloc(sizeof(char)*(c+1));

//set the for loop

for(int i = 0; i < c; i++) {

//set malloc function in the pointer

(*result)[i] = malloc(strlen(argv[i])+1);

//copy the character from memory

memcpy(argv[i], (*result)[i], strlen(argv[i])+1) ;

}

//initialize null in the pointer

(*result)[i] = NULL;

}

Explanation:

In the following code, we define function "duplicate()" and pass two character type pointer arguments "*argv" and "**result" and inside the function.

  • Set an integer type variable "c" and initialize to 0.
  • Set character type pointer variable "t" and initialize the value of pointer variable "argv".
  • Set the while loop and increment in the variable "c" and "t" by 1.
  • Set the malloc function in the pointer variable "result".
  • Set the for loop to copy the character from the memory.
  • Finally, initialize the pointer variable "result" to NULL.
8 0
3 years ago
What Is one reason that more personal computers have windows operating systems as opposed to Mac operating systems
erma4kov [3.2K]

if you search up how windows is better that mac this comes up

"99% of these users will prefer a PC to a Mac because it's the right platform for their needs. Final Cut Pro users use Macs. It doesn't run on Windows.... ... Extreme enthusiasts prefer PCs because they can run better hardware in a PC than they can get in a Mac."

all you have to do is put it in your own words :)

8 0
3 years ago
Read 2 more answers
Which of the following answers refers to a system containing mappings of domain names to various types of data, such as numerica
BartSMP [9]

Answer:

DNS or Domain Name System

Explanation:

You can query a DNS server with a domain name to get an IP address.

5 0
3 years ago
Other questions:
  • Assume that the system has a multiple level queue with a variable time quantum per queue, and that the incoming job needs 80 ms
    14·1 answer
  • What computer device works like a central nervous system?
    11·1 answer
  • What will the following segment of code output if 11 is entered at the keyboard?
    12·1 answer
  • Consider the following high-level recursive procedure: long long int flong long int n, long long int k long long int b b k+2; if
    9·1 answer
  • Media applications that play audio or video files are part of a class of workkloads called "streaming" workloads (i.e., they bri
    9·1 answer
  • What are three key characteristics of an OS process?
    11·1 answer
  • The first form of the rocket is believed have been developed in _?
    14·2 answers
  • Do you think<br> brain uploading<br> is a good idea?
    7·1 answer
  • A proposal is also known as a
    14·2 answers
  • How does beamforming improve network service?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!