• Post Reply Bookmark Topic Watch Topic
  • New Topic

Classroom help  RSS feed

 
Brian Washechek
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a little confused here. I am in a Java course at college and was wondering why these are wrong... They should be basically right in C++. <basically>. I have a book right here, so if I was on a desert island and had to do this to save the world, and the entire internet was down and the world's destruction was based on my knowledge of this I guess I could. However, I'm not on a desert island and the world is not subject to destruction based on my knowledge of this. (Ha-ha) I could attach the Java file if that's easier for to do. I'll add everything I learn to my notes for the course! Thanks a lot if you'll do it...

First question:

Second question:

Third question:

Remember, if you're kind enough to offer assistance, please tell me what you did so i can add it to my notes! You may think that this is an form of laziness, but I learn best this way.
 
Brian Washechek
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under which category should I look?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian Washechek wrote:
First question:
System.out.println("A word please:");
String inputString = in.nextLine();
String inputStringBackup= Inputstring;
System.out.println("Your word when attacked by the CAPS monster: " + toCaps(inputString));
System.out.println("Your word when attacked by the CAPS monster's son:" + lCase(inputString));
System.out.println("Your word in it's original format:" + inputStringBackup);

Remember, if you're kind enough to offer assistance, please tell me what you did so i can add it to my notes! You may think that this is an form of laziness, but I learn best this way.



Perhaps it would help us if you actually posted a question? It is just a bunch of code -- we have no idea what you are trying to ask.

Henry
 
Brian Washechek
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class Main {
public static void main(String[] args) {

System.out.println("A word,n please:");
//System.in.getln << inputString;
//inputStringBackup = inputString;
System.out.println("Your word when attacked by the CAPS monster: " + toCaps(inputString));
System.out.println("Your word when attacked by the CAPS monster's son:" + lCase(inputString));
System.out.println("Your word in it's original format:" + inputString);
}

}

I'm sure this bothers you seeing if my code will run. Could I get a link to a tutorial?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian Washechek wrote: Could I get a link to a tutorial?

Here you go
 
Campbell Ritchie
Marshal
Posts: 56520
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

As people have said, you need to express a question before anybody can give you an answer. I have added code tags, which you should always use, to your first post, and doesn't it look better
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian Washechek wrote:I am a little confused here. I am in a Java course at college and was wondering why these are wrong...

We have no idea, are these answers to homework assignments you got? How can we know that they are wrong if you don't tell us what your assignment is?

Note that Java is a completely different programming language than C++. In your second code snippet, you are writing things like cin >> tempvalue; - that is C++ code, not Java.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:
Note that Java is a completely different programming language than C++. In your second code snippet, you are writing things like cin >> tempvalue; - that is C++ code, not Java.



In addition to having code that is closer to C++ than Java, there are also a bunch of other issues, including ... trying to do mathematics (multiplication and division) with strings, having unbalanced parenthesis, and calling methods/functions that don't exist in Java or C++. etc.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!