• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java code help!!!!

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I’m completely stumped on this one???
The process of finding the largest value (i.e., the maximum of a group of values) is used frequently in computer applications. For example, a program that determines the winner of a sales contest would input the number of units sold by each salesperson. The sales person who sells the most units wins the contest. Write a pseudocode program and then a java application that inputs a series of 10 single-digit numbers as characters, and determines and prints the largest of the numbers.{Hint: Your program should use three variables as follows:
counter:A counter to count to 10 (i.e., to keep track of how many numbers have been input, and determine when all 10 numbers have been processed)

number:The current digit input to the program

largest:The largest number found so far.]
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chad
What do you have on it so far? Where are you stumped? People here will not just give you the solution to your homework, you wont learn anything that way.
Show us what you've got so far and we'll be glad to help you out.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a classic homework question. It is to test your understanding of sorting alogorithms. The easiest way to solve the problem �s with a bubble sort. Do some searching on the net and you will find the answer. But make sure you understand how the alogorithm works !!! If you learn something, learn it throughly
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basic question(s):
If you were to to this without any computer program, how would you do it?
Someone hands you ten pieces of paper with numbers on them. How do you determine which piece of paper has the largest number?
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He doesn't need a bubble sort. Since the numbers are coming in from the input stream he can just compare to see if current is greater than largest as they come in.
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas that is only true if he doesn't need to persist the inputs
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read his instructions. He doesn't need a sort.
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I stand corrected.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chad: As the others have said, think about how you would do it in real life. Getting handed pieces of paper one at a time and you have to figure out what the biggest one is by the end.
Post what you have and you will get tons of help but until then that is all that most of us would be willing to tell you about a homework problem.
 
Is this the real life? Is this just fantasy? Is this a tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic