Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Classroom help

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Under which category should I look?
 
author
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian Washechek wrote: Could I get a link to a tutorial?


Here you go
 
Marshal
Posts: 75703
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic