
In Java.
This
import java.util.Scanner;
import java.awt.Point;
class Main
{
static Scanner keyIn = new Scanner(System.in);
public static void main(String[] args)
{
int[] nums;
String lastName;
char lastInitial;
Point myPoint = new Point();
System.out.println("Please enter 5 numbers:");
nums = inputNums(5);
outputMin(nums);
changePoint(myPoint, nums);
System.out.println("The first two numbers are now stored in this object:");
System.out.println(myPoint);
// DO NOT CHANGE THE ABOVE CODE
// PLEASE WRITE THE MISSING CODE HERE
// to input the last name and output
// the initial.
}
// PLEASE WRITE YOUR 3 FUNCTIONS HERE
}
/* Sample output
(PLEASE REPLACE THIS WITH THE OUTPUT THAT YOU GET):
Please enter 5 numbers:
2 4 6 8 10
The smallest value is 2
The first two numbers are now stored in this object:
java.awt.Point[x=2,y=4]
Please enter your last name: Persiko
Hello Mx. P
Please enter 5 numbers:
50
40
30
20
10
The smallest value is 10
The first two numbers are now stored in this object:
java.awt.Point[x=50,y=40]
Please enter your last name: Smith
Hello Mx. S
*/

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images

- I could really use some help with a problem I got for coding. A screenshot showing an example would help.arrow_forwardUtilize Salary.java. The file contains a program that shows how a manager decides an employee’s salary. Two input values are read in: an employee’s current salary a rating of the employee’s performance // ************************************************************// Salary.java// ************************************************************import java.util.Scanner;import java.text.NumberFormat;public class Salary{ public static void main (String[] args) { double currentSalary; // employee's current salary double raise; // amount of the raise double newSalary; // new salary for the employee int rating; // performance rating Scanner scan = new Scanner(System.in); System.out.print ("Enter the current salary: "); currentSalary = scan.nextDouble(); System.out.print ("Enter the performance rating (3 is Excellent, 2 is Good, or 1 is Poor): "); rating = scan.nextInt(); // Enter the code here:…arrow_forwardWrite a Java program that opens a file and counts the whitespace-separated words in that file. You may obtain the name of the input file either from the command line or via prompt and user input. Be sure to clearly document the method chosen. You may test your program using any number of text files; however, you must be sure to test your program using the Sample Text File provided at the end (excerpt.txt). Sample Text File There was nothing so VERY remarkable in that; nor did Alice think it so VERY much out of the way to hear the Rabbit say to itself, `Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually TOOK A WATCH OUT OF ITS WAISTCOAT- POCKET, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to…arrow_forward
- Please help me code in java: Write a program that reads two files “Data1.txt”, “Data2.txt”; adding their corresponding elements produces an output file “output.txt”. If the number of elements are not equal, fill the elements of the smaller file up with “0” s. Sample output: Elements of the “Data1.txt”: 3 5 7 8 9 Elements of the “Data2.txt”: 45 11 Elements of the “Output.txt”: 48 16 7 8arrow_forwardWrite a java program that has the following 3 methods in addition to the main program. The main program should be interactive using a "do while loop". All input/out must be done in the main. 1. countLetter: Write a method, countLetter(...), that takes as parameter a sentence and letter and count how many times did the letter appear in the sentence. In the main the sentence are read from a file which contains many sentences and letters. Input file This is an example i The output of your program should be one of the following sentence 0 It is a palindrome or it is not a palindrome marrow_forwardUsing Math.max and/or Math.min, write a class MaxOrMin, and make sure touse Math.max and Math.min which does the following: a. Create a Scannerb. Declare two variables, number1 and number 2c. Ask the user to enter 2 numbersd. Using the information above, print messages displaying the highest and lowest values ora message if the numbers are equal. The messages should look like the sample outputbelow Tip• Use if-else statement Submission• Copy and paste your code• Screen shot the console with user input of three examples Sample Run Enter a number 5Enter a number 9The lowest value is 5The highest value is 9 Enter a number 24Enter a number 11The lowest value is 11The highest value is 24 Enter a number 12Enter a number 1212 and 12 are equalarrow_forward
- Write a program in java that will continue to prompt the user for numbers, storing them in an array, until they enter "Done" to finish, then prompts the user for a file name so that these values can be saved to that file. For example, if the user enters "output.txt", then the program should write the numbers that have been read to "output.txt".arrow_forward- Write a java program that contains a two-dimensional array of 2 rows and 3 columns. Find the sum of each row in the array, trace the code using a tracing table. - Note: No two students can try the same inputs. - You should submit the code and the tracing table in a handwritten pdf file. - Also, you should submit the code and a screenshot of the output using a word file. Tracing Table may look like the following table: Line# i j Array[0][0] Array[0][1] Array[0][2] Array[1][0] Array[1][1] Array[1][2] rowSum Output …….arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





