You aren't outputting anything. System.out.(etc) is needed to print informationNow it says that it has found bugs after analyzing my code -__-
Code:public class BetterHello { public static void main(String[] args) { String greeting = "Hello Martians I am"; int age = 27; } }
System.out.printIn();
System.out.println();
^^^^ i thought that looked weirdLOL!
I see the issue... You have been attempting to useinstead ofCode:System.out.printIn();
It should be lowercase "LN" for line not "IN"Code:System.out.println();
Lol, at forst when i watcb the tutorial in video, the "I" was unclear and look liked very strange so i assume it was low capital "l". After I realise with "in" it would make sense, because it's actual word, so that's why i added it .LOL!
I see the issue... You have been attempting to useinstead ofCode:System.out.printIn();
It should be lowercase "LN" for line not "IN"Code:System.out.println();
What's your full code?So how about it guys?
What's the error then? Also, you don't have to putPretty much the same, except with the last change.
Code:public class BetterHello { public static void main(String[] args) { String greeting = "Hello Martians I am"; int age = 27; System.out.println(greeting + " " + age); } }
System.out.println(greeting + " " + age);
String greeting = "Hello Martians I am ";
What's the error then?
ok so i fixed it, now the bug notes that there is no "years old" output in my code. So how do i add those final words?
Here's the code:Problem:
You and the Martian start becoming good friends. There is so much in common between the two of you - an interest in camping on volcanic peaks to hunting for quarters in the swimming pool. One summer afternoon, you and your Martian friend decide to play a game of Echo. The purpose of the game is to echo what the other person is saying. If the Martian says "zboggattyu", you have to reply back with "zboggattyu".
The exercise below, asks you to enter some text on the system console. This text will be stored in the variable 'someText'. This is then copied into another variable called '-echo', which is printed back to the system console. However, we are unable to get the code to compile. You have to get the code to compile, so you can play echo with your Martian friend.
What we expect:
Primarily, we expect you to get the code to compile. Once the code is compiled and run, it will ask you to enter a String on the system console. We expect the same String is echoed (printed) back on the system console.
Hint:
There are some rules governing valid variable names
Learning Outcomes:
After completing this exercise, you should have learned what constitutes a valid variable name.
import java.util.Scanner;
public class Echo {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
System.out.println("maaaaartiianaaa");
String someText = scanner.next();
String echo = "";
///{
//start your coding here
//
///}
System.out.println(echo);
}
}
Yes, I am learning then from programmr.comOut of curiosity are these java training courses online?
Solved it. Just needed the error = someText; to add.Now i came across with the 5th exersice problem. I seriously what it wants and i don't know what i should do. Here's what it says:
Here's the code:
Now just tell me where i should i start working on. To what line should i give attention to. Givee an hint. And I'll do every rest to myself.Code:import java.util.Scanner; public class Echo { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); System.out.println("maaaaartiianaaa"); String someText = scanner.next(); String echo = ""; ///{ //start your coding here // ///} System.out.println(echo); } }
I had set up on how think it should be. But it says that my code's output is 14)Problem:
You and your Martian friend go hiking up Mount Vesuvius. While exchanging stories at the campfire, he tells you about this grocer on Mars. He says, "Ze is the best grocer in this galaxy, but you have to respect ze wishes." It seems Ze sells only two items - Zomatoes, and Zinions. But that's not all. Ze will not sell you an arbitrary number of items. The minimum order is 65 and the maximum order is 122. What's more, you cannot ask for 65 Zomatoes. You have to ask for 'A' Zomatoes. Similarly, you cannot ask for 122 Zinions. You have to ask for 'z' Zinions. Confused ? The ASCII value of (uppercase) 'A' is 65 and the ASCII value of (lowercase) 'z' is 122.
In this exercise you have to add the ASCII values of 2 char variables.
What we expect:
In this exercise, Ze will ask you for the number of Zomatoes and Zinions you want to buy. You have to enter an ASCII character in the range [A-Za-z] for both. The number of Zomatoes you want to buy will be given to you in a variable called 'zomatoes', which is of type 'char'. The number of 'Zinions' you want to buy will be given to you in a variable called 'zinions', which is also of type char. You have to add the ASCII values of both the char variables (zomatoes and zinions) and populate the variable called 'items', which is of type 'int', with the sum. For example if you asked for 'a' Zomatoes and 'C' Zinions, the total number of items is 'a'(97) + 'C'(67) = 164
Hint:
Typecasting ! nuff said.
import java.util.Scanner;
public class CrazyConverter {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
System.out.println("Hello I am your friendly grocer Darth: ");
System.out.println("How many zomatoes do you want ? a");
String sZomatoes = scanner.nextLine();
System.out.println("How many zinions do you want ? C");
String sZinions = scanner.nextLine();
char zomatoes = sZomatoes.charAt(98);
char zinions = sZinions.charAt(67);
int items = 165;
///{
//start your coding here
//end
///}
System.out.println("Thank you ! you have asked for " + items + " items");
}
}