Question

Please answer all the questions and I don't want work for another person. do it in jaf project.

5.6 (Conversion from m to kilometers) Write a program that displays the following two tables side by side: Miles Miles Kilometers Kilometers 1.609 20 12.430 15.538 3.218 25 37.290 14.481 60 I 65 40.398 10 16.090 5.8 (Find the highest score) Write a program that prompts the user to enter the number of students and each students name and score, and finally displays the name of the student with the highest score. Use the next method in the Scanner class to read a name rather using the nextLine method

0 0
Add a comment Improve this question Transcribed image text
Answer #1


public class MilesToKilometers
{
   public static void main(String[] args)
   {
       System.out.printf("%-12s%-12s %s   %-12s%-12s\n",
               "Miles", "Kilometers", "|", "Kilometers", "Miles");
       int miles = 1;
       int kilometers = 20;
       while (miles <= 10)
       {
           System.out.printf("%-12s%-12.3f %s   %-12d%-12.3f\n",
                   miles, (double)miles * 1.609, "|",
                   kilometers, (double)kilometers / 1.609);
           miles++;
           kilometers = kilometers + 5;
       }
   }
}


Problems@Javadoc Declaration Console <terminated> MilesToKilometers [Java Application] C:\Program Files Javaljrel.6.0_011binl

import java.util.Scanner;
import java.util.Arrays;

public class FindTheHighestScore {

  
   public static void main(String[] args)
   {
       // input
       String[] names;
       double[] scores;
       Scanner input = new Scanner(System.in);
       int students;
       double highScore;
       int[] scoreIndexes = new int[1];
      
       System.out.print("How many students are there?: ");
       students = input.nextInt();
       input.nextLine();
       names = new String[students];
       scores = new double[students];
      
       // processing
           // Filling in arrays with data
       for(int i = 0; i < students; i++)
       {
           System.out.print("What is the student's name?: ");
           names[i] = input.nextLine();
           System.out.print("What is the student's score?: ");
           scores[i] = input.nextDouble();
           input.nextLine();
       }
      
       highScore = scores[0];
       scoreIndexes[0] = 0;
           // Finding highest score/s
       for (int i = 1; i < names.length; i++)
       {
           // find if it's a high, same, or low score
               // If high, set highScore, reset scoreIndexes and set scoreIndexes[0] to i.
           if (highScore < scores[i])
           {
               highScore = scores[i];
               // integerArray = Arrays.copyOf(integerArray, i + 1); notes.
               scoreIndexes = Arrays.copyOf(scoreIndexes, 1);
               scoreIndexes[0] = i;
           }
               // If same, increase scoreIndexes size and set new int at end of array to i.
           else if (highScore == scores[i])
           {
               scoreIndexes = Arrays.copyOf(scoreIndexes, scoreIndexes.length + 1);
               scoreIndexes[scoreIndexes.length - 1] = i;
           }
               // If low, continue (aka do nothing here).
           else ;
       }
      
       // output
       System.out.printf("%d people have the high score.\n", scoreIndexes.length);
       System.out.printf(
               "The high score was %f\nThe names of the students with the high score are...\n", highScore);
       for (int i = 0; i < scoreIndexes.length; i++)
           System.out.printf("%s\n", names[scoreIndexes[i]]);
      
       input.close();
   }

}


Problems JavadocDeclaration Console <terminated> _FindTheHighestScore [Java Application] C:Program Filesarel.6.0_01\binljavaw


public class ASCIICharacterTable
{
   public static void main(String[] args)
   {
       // Decleare int outputCount and initialize to 0;
       // Create character i intialize at '!' and stop loop at '~'
       // Display character then space and increment outputCount
       // If outputCount % 10 == 0 then println

       int outputCount = 0;
       for (char i = '!'; i <= '~'; i++)
       {
           System.out.printf("%c ", i);
           ++outputCount;
           if (outputCount % 10 == 0)
               System.out.println();
       }
   }
}


Problems Javadoc@ Declaration Console X <terminated> ASCIICharacterTable [Java Application CProgram FilesJavajre1.6.0_01\bin

//package chapter_5;

import java.util.Scanner;

public class DisplayPyramid
{
   public static void main(String[] args)
   {
       // input
       Scanner input = new Scanner(System.in);
       int number;

       System.out.print("Enter an integer from 1 to 15: ");
       number = input.nextInt();

       // processing and output
       for (int j = 0; j < number; j++)
       {
           for (int i = -number + 1; i < number; i++)
           if (Math.abs(i) <= j)
               System.out.printf("%-3d", Math.abs(i) + 1);
           else
               System.out.printf("   ");
           System.out.println();
       }
       input.close();
   }
}


Add a comment
Know the answer?
Add Answer to:
Please answer all the questions and I don't want work for another person. do it in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • *MYST BE I NJAVA* *PLEASE INCORPORATE ALL OF STRING METHODS AND SCANNER METHOD LISTED IN THE...

    *MYST BE I NJAVA* *PLEASE INCORPORATE ALL OF STRING METHODS AND SCANNER METHOD LISTED IN THE DIRECTIONS BELOW* Write a Java class that takes a full name (first and last) as inputted by the user, and outputs the initials. Call the class Initials. The first and last names should be entered on the same input line i.e. there should be only one input to your program. For example, if the name is Jane Doe, the initials outputted will be J...

  • ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will...

    ANY HELP PLEASE. PLEASE READ THE WHOLE INSTRUCTION THANK YOU Write a program GS.java that will be responsible for reading in the names and grades for a group of students, then reporting some statistics about those grades. The statistics to be gathered are the number of scores entered, the highest score and the name(s) of the student(s) who earned that score, the lowest score and the name(s) of the student(s) who earned that score, and the average score for the...

  • I've done all questions except question 6. how do I do this? please help. code needs...

    I've done all questions except question 6. how do I do this? please help. code needs to be java 1. You need to be able to open and read the text files that have been provided for the project. Write a Java program that reads the driver.txt file and displays each data value for each line from the file to the screen in the following format: Licence Number: Licence Class: First Name: Last Name: Address: Suburb: Postcode: Demerit Points: Licence...

  • I want to know how to do this assignment!!! Help me please~ The first part of...

    I want to know how to do this assignment!!! Help me please~ The first part of your program should do the following: • Ask the user type of test they took. o (ACT or SAT) • If they said ACT then ask them their score o If their ACT score was between 0 and 7 say "Needs Work" o If their ACT score was between 10 and 20 say "Acceptable" o If they ACT score was above 20 say "Above...

  • this is a java course class. Please, I need full an accurate answer. Labeled steps of...

    this is a java course class. Please, I need full an accurate answer. Labeled steps of the solution that comply in addition to the question's parts {A and B}, also comply with: (Create another file to test the class and output to the screen, not an output file) please, DO NOT COPY others' solutions. I need a real worked answer that works when I try it on my computer. Thanks in advance. Write the definition of the class Tests such...

  • PLEASE HELP, Java question. I posted this question before and had no reply. Attached Files: diving_data.txt...

    PLEASE HELP, Java question. I posted this question before and had no reply. Attached Files: diving_data.txt (411 B) Chen Ruolin 9.2 9.3 9 9.9 9.5 9.5 9.6 9.8 Emilie Heymans 9.2 9.2 9 9.9 9.5 9.5 9.7 9.6 Wang Xin 9.2 9.2 9.1 9.9 9.5 9.6 9.4 9.8 Paola Espinosa 9.2 9.3 9.2 9 9.5 9.3 9.6 9.8 Tatiana Ortiz 9.2 9.3 9 9.4 9.1 9.5 9.6 9.8 Melissa Wu 9.2 9.3 9.3 9.7 9.2 9.2 9.6 9.8 Marie-Eve Marleau...

  • PYTHON. Continues off another code. I don't understand this. Someone please help! Comment the lines please...

    PYTHON. Continues off another code. I don't understand this. Someone please help! Comment the lines please so I can understand LinkedList ADT: class myLinkedList:     def __init__(self):         self.__head = None         self.__tail = None         self.__size = 0     def insert(self, i, data):         if self.isEmpty():             self.__head = listNode(data)             self.__tail = self.__head         elif i <= 0:             self.__head = listNode(data, self.__head)         elif i >= self.__size:             self.__tail.setNext(listNode(data))             self.__tail = self.__tail.getNext()         else:             current = self.__getIthNode(i - 1)             current.setNext(listNode(data,...

  • I ONLY need question 2 part C AND D answered...it is in bold. Please do not...

    I ONLY need question 2 part C AND D answered...it is in bold. Please do not use hash sets or tables. In java, please implement the classes below. Each one needs to be created. Each class must be in separate file. The expected output is also in bold. I have also attached the driver for part 4 to help. 1. The Student class should be in the assignment package. a. There should be class variable for first and last names....

  • Please do all of them I have no more questions remain to ask so please do...

    Please do all of them I have no more questions remain to ask so please do all of them I would really appreciate it I do Rate Please do all of them :) I really need help doing my hw I don't understand it please help me Clam rences] 1 pt Use the References to access important values if needed for this question. 1 pt Oxides can react with water to form acids or bases. Identify each of the following...

  • PYTHON. Continues off another code(other code is below). I don't understand this. Someone please help! Comment...

    PYTHON. Continues off another code(other code is below). I don't understand this. Someone please help! Comment the lines please so I can understand. There are short and med files lengths for each the list of names/ids and then search id file. These are the input files: https://codeshare.io/aVQd46 https://codeshare.io/5M3XnR https://codeshare.io/2W684E https://codeshare.io/5RJwZ4 LinkedList ADT to store student records(code is below). Using LinkedList ADT instead of the Python List. You will need to use the Student ADT(code is below) Imports the Student class...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT