Newbie Coders Chat

Announcements Posted on
How helpful is our apprenticeship zone? Have your say with our short survey 02-12-2016
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    thankyou thankyou thanksyou, there you got three.
    As long as you mean it.
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    As long as you mean it.
    I do mate. Listen yes, i'm sorry for being a ****head with you earlier, but i was just messing around. Also i am way out of my depth with this programming. I have just done a quiz which only had one chance to get it right, and i got something like 3/10. As i said i haven't done programming for a loonng time, and i don't think that it is right that they advertised this as something available for beginners.

    I have til monday to pass these projects, so hopefully if you can help me with them in the next day or so, then i can make sure the answers pass, this will be a big help. And I can pay you for this as well, if you like?

    Thanks again John.
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    I do mate. Listen yes, i'm sorry for being a d*head with you earlier, but i was just messing around. Also i am way out of my depth with this programming. I have just done a quiz which only had one chance to get it right, and i got something like 3/10. As i said i haven't done programming for a loonng time, and i don't think that it is right that they advertised this as something available for beginners.

    I have til monday to pass these projects, so hopefully if you can help me with them in the next day or so, then i can make sure the answers pass, this will be a big help. And I can pay you for this as well, if you like?

    Thanks again John.
    It's all fine, payment not required. I'm working on the exercises right now.
    Here's my big piece of advice: read a book on Java. Perhaps this book will be good for you because it explains things in a simple manner. Practice alone isn't sufficient, as you've noticed. You need the theoretical background, mate.
    Offline

    2
    ReputationRep:
    A very excellent book for coders (new and experienced): Code: The Hidden Language of Computer Hardware and Software

    Does a brilliant job of explaining the very fundamentals of programming and computers in general - well worth a read.
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    here is my latest task:
    Attachment 583636

    here is the code i have so far: It is very messy atm sorry:

    import java.util.Scanner;public class EmailGenerator { String firstQuestion = "What is your first name?"; String secondQuestion = "What is your second name?"; String firstChar = firstName.substring(0,1); String fullName = secondName.substring(0,stringLen gth); String a "derby.ac.uk"; public class makeUserName { String firstChar + fullName;} Scanner s = new Scanner(System.in); void sayName() { System.out.println(firstQuestion ); } String firstName=s.nextLine(); void sayName() { System.out.println(secondQuestio n); } String secondName=s.nextLine(); public string makeEmail(makeUsername("at"+a){} EmailGenerator makeEmail = new EmailGenerator(); System.out.println("This user's email is: " +makeEmail+ );} public static void main(String[] args) {}; }

    Good luck with this!
    Solution here:
    http://pastebin.com/YTga7pAg
    Offline

    2
    ReputationRep:
    (Original post by jungle_ninja)
    A very excellent book for coders (new and experienced): Code: The Hidden Language of Computer Hardware and Software

    Does a brilliant job of explaining the very fundamentals of programming and computers in general - well worth a read.
    Ah, another one to add to my shelf for later reading. Thanks.
    Offline

    3
    ReputationRep:
    Ask questions John you need to understand that code or you will never catch up.
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    Solution here:
    http://pastebin.com/YTga7pAg
    Thanks 571, well the good news is that i got something like 17 out of 22 for that submission, so it was really bang on.

    I have had another look at the next one, and done some thinking about it. Also the final deadline for all of the work has been put back til the 17th of this month. You really are a life saver.

    Here is the next piece of code which i need help with. We need to change it, so that it takes the string sentance, and string word, and removes the word from the sentance, here is the code so far anyway. See what you think thanks!

    John
    ** @author your_name*/ public class RemoveIt { //TODO: instantiate class variables String sentence; /** @param sentence String to manipulate */ public RemoveIt(String sentence) { //TODO: constructor definition this.sentence = "A kittycat is at the door"; String RemoveIt = sentence } i need to remove the word "cat" from the argument?? /** @param toRemove String to remove from sentence * @return manipulated String */ public String remove(String phrase) { //TODO: remove definition } }
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Thanks 571, well the good news is that i got something like 17 out of 22 for that submission, so it was really bang on.

    I have had another look at the next one, and done some thinking about it. Also the final deadline for all of the work has been put back til the 17th of this month. You really are a life saver.

    Here is the next piece of code which i need help with. We need to change it, so that it takes the string sentance, and string word, and removes the word from the sentance, here is the code so far anyway. See what you think thanks!

    John
    ** @author your_name*/ public class RemoveIt { //TODO: instantiate class variables String sentence; /** @param sentence String to manipulate */ public RemoveIt(String sentence) { //TODO: constructor definition this.sentence = "A kittycat is at the door"; String RemoveIt = sentence } i need to remove the word "cat" from the argument?? /** @param toRemove String to remove from sentence * @return manipulated String */ public String remove(String phrase) { //TODO: remove definition } }
    I'm glad to hear you got good marks from that submission. I'll work on the rest of the assignments today.
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Here are the other assignments i have:
    A class called GiveChange is provided below. The design of this class is to take a decimal amount from the user representing the change due to them from a purchase, and return the number of quarters, dimes, nickels and pennies that should be given to the user to make that total.The main method has been defined for you, and utilizes four static methods: getQuarters, getDimes, getNickels, and getPennies. Each method takes the total change in pennies (i.e., $3.80 = 380 pennies). As the denomination gets smaller, additional parameters are added to represent the number of quarters, dimes and nickels that minimize the change returned.Write the method definitions for getQuarters, getDimes, getNickels, and getPennies.

    /* author your_name*/import java.util.Scanner;public class GiveChange { /** param p number of pennies * return number of quarters */ public static int getQuarters(int p) { //TODO: method definition for getQuarters } /** param p number of pennies * param q number of quarters * return number of dimes */ public static int getDimes(int p, int q) { //TODO: method definition for getDimes } /** param p number of pennies * param q number of quarters * param d number of dimes * return number of nickels */ public static int getNickels(int p, int q, int d) { //TODO: method definition for getNickels } /** param p number of pennies * param q number of quarters * param d number of dimes * param n number of nickels * return number of leftover pennies */ public static int getPennies(int p, int q, int d, int n) { //TODO: method definition for getPennies } public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("How much change is to be given?"; double change = s.nextDouble(); int pennies = (int)(change * 100); int q = getQuarters(pennies); int d = getDimes(pennies, q); int n = getNickels(pennies, q, d); int p = getPennies(pennies, q, d, n); String str = String.format("The customer should recieve %d " + "quarters, %d dimes, %d nickels, " + "and %d pennies.", q, d, n, p); System.out.println(str); }
    Solution for GiveChange below:
    http://pastebin.com/ctyjriN2

    Disclaimer: I suck at math, so my algorithm might not be the most efficient or correct one. Please keep that in mind.

    Explanation

    Basics (variables) first:

    1 penny = 1 cents
    1 nickel = 5 cents
    1 dime = 10 cents
    1 quarter = 25 cents

    As the denominator gets smaller, we need more types of coins:

    let p = total amount of pennies
    q = p / 25;
    d = p / 10;
    n = p / 5;

    Logical steps:

    I have to give you 380 cents.

    1) How many quarters can I get out of that?
    -> Remove 25 pennies until you can't anymore.

    2) How many dimes can I get out of the remainder of the above?
    -> Remove 10 pennies (if you can) until you cant anymore

    3) How many nickels can I get out of the remainder of the above?
    -> Remove 5 pennies (if you can) until you cant anymore

    4) How many pennies can I get out of the remainder of the above?
    -> The pennies that are left.

    Mathematical steps:
    (example provided with 58 pennies)

    a) Get the number of quarters: 58 pennies / 25 = 2 quarters and 0.32 quarters remainder (or 0.32 * 25 = 8 pennies)

    b) Now that we know there are 2 quarters in that amount of pennies, we remove that same amount: 50, which leaves us with 8 pennies.

    c) Get the number of dimes: 8 pennies / 10 = 0.8 dimes, in other words: 0 dimes.

    d) Get the number of nickels: We weren't able to transform those 8 pennies into dimes, so now we are left with them to turn them into nickels.
    8 / 5 = 1 nickel, 3 pennies left

    e) Get the number of pennies left in total: We just removed 5 pennies from our 8 and now we're left with 3 pennies.
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Thanks 571, well the good news is that i got something like 17 out of 22 for that submission, so it was really bang on.

    I have had another look at the next one, and done some thinking about it. Also the final deadline for all of the work has been put back til the 17th of this month. You really are a life saver.

    Here is the next piece of code which i need help with. We need to change it, so that it takes the string sentance, and string word, and removes the word from the sentance, here is the code so far anyway. See what you think thanks!

    John
    ** @author your_name*/ public class RemoveIt { //TODO: instantiate class variables String sentence; /** @param sentence String to manipulate */ public RemoveIt(String sentence) { //TODO: constructor definition this.sentence = "A kittycat is at the door"; String RemoveIt = sentence } i need to remove the word "cat" from the argument?? /** @param toRemove String to remove from sentence * @return manipulated String */ public String remove(String phrase) { //TODO: remove definition } }
    Solution for RemoveIt below:
    http://pastebin.com/AhfqrmjR

    Tip: whenever they mention class variable, that means they want you to put the keyword static in front of your variable, like I did in the solution code.

    Note: Please post your code in pastebin in the future because TSR doesn't
    format it properly.
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    Solution for RemoveIt below:
    http://pastebin.com/AhfqrmjR

    Tip: whenever they mention class variable, that means they want you to put the keyword static in front of your variable, like I did in the solution code.

    Note: Please post your code in pastebin in the future because TSR doesn't
    format it properly.
    Thanks for helping me with those last programs 571, we got top marks for them!
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Thanks for helping me with those last programs 571, we got top marks for them!
    May I know the specific marks?
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    May I know the specific marks?
    100% for both of those programs you just did. The email one wasn't quite full, but i don't know why that was. And I was heavily let down by a multiple choice test i did, where they changed the grading scheme from the best of three, to one chance only. I only got something like 25% for this. But I am confident i will be able to get the 50% pass grade, if you keep on helping me like this.

    The final grades aren't released until the end, in two weeks, but i can show you my grades so far. Also i am not sure if i want to carry on to do the second module. Would you still be able to help me as you have been doing, if i do decide to do this? But even still i have a new job starting up in a couple of weeks, and there is also a psychology mooc i have signed up to, so without your help i just won't be able to do it? What do you think 571?

    Name:  comscigradesv1.jpg
Views: 26
Size:  150.7 KB
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Also i am not sure if i want to carry on to do the second module. Would you still be able to help me as you have been doing, if i do decide to do this? But even still i have a new job starting up in a couple of weeks, and there is also a psychology mooc i have signed up to, so without your help i just won't be able to do it? What do you think 571?
    Well, John, like you, I have many things to do in my life as well, so here is my suggestion: I'll help you out if I have the time. Until now, the coding has been easy enough to do in a couple of minutes (well, except for the GiveChange one, that took me 24 hours because I suck at math).

    The question is, John, if you are learning any valuable lessons from the code I write up. I have the feeling you just accept my solutions and post them, which would not be very beneficial for your learning process.
    It's important to learn something new every time and to add that to your knowledge and skill set to be able to do something with it.
    Please tell me if you are learning from my code because it's important for now and for your future endeavors

    Make sure you read a Java book, you'll help yourself a lot!
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    Well, John, like you, I have many things to do in my life as well, so here is my suggestion: I'll help you out if I have the time. Until now, the coding has been easy enough to do in a couple of minutes (well, except for the GiveChange one, that took me 24 hours because I suck at math).

    The question is, John, if you are learning any valuable lessons from the code I write up. I have the feeling you just accept my solutions and post them, which would not be very beneficial for your learning process.
    It's important to learn something new every time and to add that to your knowledge and skill set to be able to do something with it.
    Please tell me if you are learning from my code because it's important for now and for your future endeavors

    Make sure you read a Java book, you'll help yourself a lot!
    Yes I am learning from it, but maybe not as much as i should. Plus it is kind of like cheating, and i don't want to make a habit of it, so i guess i will call it a day after this one. Thanks for the help anyway!
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Yes I am learning from it, but maybe not as much as i should. Plus it is kind of like cheating, and i don't want to make a habit of it, so i guess i will call it a day after this one. Thanks for the help anyway!
    In school, providing solutions is called 'cheating', in the real world, it's called 'collaboration'.
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    In school, providing solutions is called 'cheating', in the real world, it's called 'collaboration'.
    You know you look like eminem?
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    You know you look like eminem?
    That's not me, that's Eminem, his name is Marshall Mathers. That image is a screenshot from his video 'Role Model'.
    Offline

    3
    ReputationRep:
    (Original post by 571122)
    That's not me, that's Eminem, his name is Marshall Mathers. That image is a screenshot from his video 'Role Model'.
    Yes, I was going to say you must be his twin or something
 
 
 
Write a reply… Reply
Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. Oops, you need to agree to our Ts&Cs to register
  2. Slide to join now Processing…

Updated: November 25, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Today on TSR
Poll
Would you rather have...?
Useful resources
Study resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.