java - Am I returning the correct value from my method & am I writing it correctly? -


I will present my question with the statement that I am very new to Java, so I apologize that my code is completely To read is hateful.

What I am trying to do: I am writing a program that takes two integers from the user, both a lower value and a higher value, and two integers Different methods are different for method # 1 loop and should print all the numbers between the following numbers and the highest number which are multiples of 3 or 5, and the method # 2 excludes numbers which is 3 or There are multiples of 5 which also checks Is that number also a valuable value of 6, and if so, print that number and print an asterisk in front of it

What's the problem with me? What should I do to get back to my ways, but is very much stumped; How to return anything to everything This is the first time I have worked properly on a system (just went "above the Hello World") and I can see that I really do not have to return anything . The methods I've put in the code have completed the program very much, so I thought that the integers I have sent, they will be enough, apparently this will not happen. Therefore, without further ado, here's my code.

Error:

  javac bunusq.java. \ MethodOne.java: 19: Error: Invalid startup type return (lowest limit, int highest range); ^. \ MethodTwo.java: 36: Error: The introduction of invalid type returns (int weak range, intrest range); ^  

Main:

  import java.util.Scanner; Public class Bonsaka {public static zero main (string [] args) {scanner scan = new scanner (system.); Int weak range = 0; Int exchange = 0; System.out.println ("Enter the minimum integer in your category"); Lowrenz = scan. NXIT (); System.out.println ("Enter the highest integer in its category"); Highest Range = Scan. NXIT (); MethodOne.No estric (lowest range, highest range); MethodTwo.Asterisk (lowest range, highest range); }}  

Methodon:

  the public class MethodOne {public static int no asterisk (int at least range, int highest range ) {For (Int i = lowest range; i <= highest range; i ++) {if (i% 5 == 0) {System.out.println (i); } And if (i% 3 == 0) {System.out.println (i); }}} Return (lowest range, int highest range); } {/ Code>  

Method two:

  public class MethodTwo {public static Intel Asterisk (int lowest range, int highest range) {For (int i = lowest range; i & lt; = highest range; i ++) {if (i% 5 == 0) {if (i% 5 == 0 and amp; i% 6 == 0 } {System.out.println (i + "*");} Else {System.out.println (i);}} and if (i% 3 == 0) {if (i% 3 == 0 and amp ; I% 6 == 0} {System.out.println (i + "*");} Else {System.out.println (i);}}}} Returns (lowest range, int highest range) ;}  

Sorry if the post is a bit muscular to read, then I think that the code You can understand what is going wrong, because you do not know the limit of my inability :)

Thanks in advance

You do not need to back anything, because the methods are printing all the values. / P>

You convert them to zero methods For example,:

  public static zero star (int minimum, topmost highest) {// loop And if there is no statement / no return statement! }  

The code will run in the rules and the wallet will go away, you have done it!

EDIT: That is being said, a lot can be done to do this code more like Java, but for now it will work.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -