Question

write a static method named greet that takes a String that represents a name and prints...

write a static method named greet that takes a String that represents a name and prints a personalized greeting to StdDraw.

So far i have in the main method...

4 public class TakeHomeAssignment
5 {
6 public static void main(String[] args)
7 {
8 StdDraw.setScale(0,500);
9 //drawEye(250,250,50);
10 String greet(Aaron);
11 // drawStickFigure(250,250);

and for the method;

//public static String greet( name)
31 //{
32
33
34 //StdDraw.text(250,250,"Hello" +name);
35
36 // }

Im getting errors saying its an illegal start of an expression and so on. Im fairly new to this method of writting a method then pulling them and putting them in the main method. How would i get this code to work properly?

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
write a static method named greet that takes a String that represents a name and prints...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Write a static method called encodeString that takes a string as input and prints to the...

    Write a static method called encodeString that takes a string as input and prints to the console a word where each letter is advanced by one value. In addition, your method should return the encoded String. You may make use of the method provided below to help you. public static char encode(char x) { int current = x; current++; return (char)current; } This method takes a character and returns an "encoded" character. In other words, encode('a') will return 'b'. Your...

  • Write a static method called printWithSpaces that takes a String as its parameter and prints the...

    Write a static method called printWithSpaces that takes a String as its parameter and prints the characters of the string separated by spaces. For example: > Methods.printWithSpaces("method") m e t h o d You should have a single space after the last character. This method should not return a value. That is similar to this code for printing the string vertically public static void printVertical(String s) { for (int i = 0; i < s.length(); i++) { char c =...

  • Question 1[JAVA] Add a method in the Main class named getLines() that takes a filename as...

    Question 1[JAVA] Add a method in the Main class named getLines() that takes a filename as a String and returns each line in the file in an array. Have each element of the array be a String. Do not include the newline at the end of each line. Use a BufferedReader object to read the file contents. Note, the contents of input.txt will be different (including the number of lines) for each test case. Example: getLines( "input.txt" ) returns (an...

  • Getting started with Java on elvis Download Greeting.java from the class web site. Use FileZilla to...

    Getting started with Java on elvis Download Greeting.java from the class web site. Use FileZilla to place it into your Lab5 directory. Look at the content of your directory to see the file using the command ls Look at the content of the file in your directory using the command more Greeting.java Compile the HelloClass program using the command javac Greeting.java. Then use ls to see your class file. Run the program without parameters using the command java Greeting Run...

  • Write a public static method named getMaxOf2Ints that takes in 2 int arguments and returns the...

    Write a public static method named getMaxOf2Ints that takes in 2 int arguments and returns the Maximum of the 2 values Write a public static method named getMinOf2Ints that takes in 2 int arguments and returns the Minimum of the 2 values Write apublic static method named getMaxOf3Ints that takes in 3 int arguments and returns the Maximum of the 3 values Write a public static method named getMedianOf3Ints that takes in 3 int arguments and returns the Median Value...

  • How can I change the following program and Implement a print() method for Percolation that prints...

    How can I change the following program and Implement a print() method for Percolation that prints 1 for blocked site, 0 for open sites and * for full sites? public class Visualizeheimadaemi { public static void main(String[] args) { int N = Integer.parseInt(args[0]); double p = Double.parseDouble(args[1]); int M = Integer.parseInt(args[2]); // repeatedly created N-by-N matrices and display them using standard draw for (int i = 0; i < M; i++) { boolean[][] open = Percolation.random(N, p); StdDraw.clear(); StdDraw.setPenColor(StdDraw.BLACK); Percolation.show(open,...

  • Write a method called printReverse() that takes a string and uses recursion to print the contents...

    Write a method called printReverse() that takes a string and uses recursion to print the contents of the string in reverse order. The string itself should not be reversed; it must be left in its original form. The method has the following header:   void printReverse(String s, int i) where s is a reference to the string, and i is an integer parameter that you may use as you see fit. You do not need to code up this method as...

  • Please show public static void main (String args[]) {} method too! 9. Given a list containing...

    Please show public static void main (String args[]) {} method too! 9. Given a list containing two or more integers, this method returns a set containing the two integers in the list that are closest to each other; i.e. the absolute value of the difference between them is minimal. The returned set must be sorted. public static Set<Integer> closest(List<Integers list) Example, if list = [21, 4, 2, 12, 18, 24, 16, 7, 20, 39, -3, 26] then the return should...

  • *q3: Write a public static method named q3 that takes no parameters and has return type...

    *q3: Write a public static method named q3 that takes no parameters and has return type void. In this method, you may assume there is a file named "properties.csv" with lines in the format "name, opposed, pure,glad" where "name" is a String and all other values are well-formed integers. There is no header line in this file. This method will create a new * file named "output.csv" in the format "name, pure" containing only these two columns from "properties.csv" and...

  • Using listAllFiles as a guide, write a method that has one File argument: if the argument...

    Using listAllFiles as a guide, write a method that has one File argument: if the argument is a directory, the method returns the total number of files below it. If the argument represents a file, the method just returns 1. public static int countFiles(File f)   import java.io.File; public class FileLister { public static void main(String[] args) { // Choose the directory you want to list. // If running in Eclipse, "." will just be the current project directory. // Use...

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
ADVERTISEMENT