Jump to content

My Java class has these labs due on Saturdays and man I can envision so many people failing this course if they aren't super dedicated. Here is an example of one of our labs just a few weeks into the semester. 

 

Prompt: 

1907407808_ScreenShot2019-02-16at9_18_37AM.thumb.png.832b69cb5dada81f6e80d82830fde532.png

import java.util.Scanner;

public class TextMsgExpander {
   public static void main(String[] args) {
      /* Type your code here. */
      Scanner scnr = new Scanner(System.in);
      String userInput;
      
      System.out.println("Enter text:");
      
      userInput = scnr.nextLine();
      
      System.out.println("You entered: " + userInput);
      System.out.println();
      
      if (userInput.indexOf("BFF") != -1) {
         userInput = userInput.replace("BFF", "best friend forever");
         System.out.println("Replaced " +"\"BFF\"" + " with " + "\"best friend forever\"" + ".");
      }
      if (userInput.indexOf("IDK") != -1) {
         userInput = userInput.replace("IDK", "I don't know");
         System.out.println("Replaced " +"\"IDK\"" + " with " + "\"I don't know\"" + ".");
      }
      if (userInput.indexOf("JK") != -1) {
         userInput = userInput.replace("JK", "just kidding");
         System.out.println("Replaced " +"\"JK\"" + " with " + "\"just kidding\"" + ".");
      }
      if (userInput.indexOf("TMI") != -1) {
         userInput = userInput.replace("TMI", "too much information");
         System.out.println("Replaced " +"\"TMI\"" + " with " + "\"too much information\"" + ".");
      }
      if (userInput.indexOf("TTYL") != -1) {
         userInput = userInput.replace("TTYL", "talk to you later");
         System.out.println("Replaced " +"\"TTYL\"" + " with " + "\"talk to you later\"" + ".");
      }
      
      System.out.println();
      System.out.println("Expanded: " + userInput);
   }
}

It's actually not too difficult if you read the material and can think like a computer, but the professor has already said that most of the class isn't even doing the participation activities which anyone with very little skill could do in a few minutes. 

  1. Sauron

    Sauron

    Quote

    the professor has already said that most of the class isn't even doing the participation activities which anyone with very little skill could do in a few minutes. 

    Yeah, welcome to CS university courses... some people just aren't cut for it.

     

    On a side note... ugh, Java ?

  2. DrMacintosh

    DrMacintosh

    Java is my first real programming course and so far I actually like it. In High School we had a game design class that used Construct, and tbh I think that class really prepared me in terms of mindset and how to approach the task at hand. 

     

    Professor said she didn't recommend java as a first language, but I'm trying and doing pretty good so far!

  3. BuckGup

    BuckGup

    I can literally do anything but program. But I have to pass the classes for the major

  4. Sauron

    Sauron

    Yeah, Java works if nothing else... but frankly I'd rather use almost anything else if given a choice. Want something easy and with wide support? Python. Want something fast? Rust/C/C++. Android development? Kotlin (even if it uses the JVM, at least the syntax and type system are sane). Web development? Go/Ruby/JS/Python/Elixir...

     

    There's something I inherently dislike about a language that requires the use of an IDE with complex automation tools to compile anything larger than hello world.

  5. DrMacintosh

    DrMacintosh

    Yeah, like I said I'm rather new so I haven't experienced any of the conveniences of other languages. Thankfully this CS course uses  ZyBooks and all of our coding can be done inside its web interface. 

     

    Getting an IDE to work on my computers was very frustrating as they are all different and have their own errors if you don't set them up properly. 

  6. Sauron

    Sauron

    Try python, it lets you do a lot with little effort and you can just use a text editor.

  7. DrMacintosh

    DrMacintosh

    That will probably be my next language. I need to take 1 object oriented programing course per semester.

  8. Sauron

    Sauron

    oof, OOP is out of fashion... all the cool kids do functional! ?

  9. ARikozuM

    ARikozuM

    Functional is one helluva drug. 

     

    ...

     

    I'll leave now.

  10. BuckGup

    BuckGup

    Seeing how popular python is now I feel like they should be teaching it instead of Java

  11. Sauron

    Sauron

    They do in a lot of places, it was in my first university programming course over 4 years ago. Not sure why that's not the case for him.

  12. BuckGup

    BuckGup

    In the two places I have been it's just Java and Python later on if you go down the path of AI

×