Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 4 / hometask 4 #1

Open
Amachuarori opened this issue Nov 23, 2020 · 1 comment
Open

Chapter 4 / hometask 4 #1

Amachuarori opened this issue Nov 23, 2020 · 1 comment

Comments

@Amachuarori
Copy link

Amachuarori commented Nov 23, 2020

Hometask was rejected for 2 times, and cant understand why, coz the main task is performing. Hope, u'll help , thanks!
the conditions are:

  1. Return to your 2nd homework assignments, when you described your favorite song.

  2. Refactor that code so all the variables are held as in a single data structure as keys and values.

  3. Refactor your print statements so that you have a single loop that passes through each item in the data structure and prints out it's key and then it's value.


program

String sname = "I think I just died";
String rating = "A"; /* rating is measuring from u to a (U,F,E,D,C,B,A) */
String worldRanking = "4";
String homeCountryRanking = "5";
String averageRanking = "4.5";
String genre = "pop";

    Map<String, String> description = new HashMap<>();
    description.put("SongName" , sname);
    description.put("Rating" , rating);
    description.put("WorldRank" , worldRanking);
    description.put("HomeRank" , homeCountryRanking);
    description.put("Average" , averageRanking);
    description.put("genre" , genre);
    for(Map.Entry<String, String> item : description.entrySet()){
        System.out.println(item.getKey() + " " +  item.getValue());
    }

home4

@margmelo
Copy link

Hometask was rejected for 2 times, and cant understand why, coz the main task is performing. Hope, u'll help , thanks!
the conditions are:

  1. Return to your 2nd homework assignments, when you described your favorite song.
  2. Refactor that code so all the variables are held as in a single data structure as keys and values.
  3. Refactor your print statements so that you have a single loop that passes through each item in the data structure and prints out it's key and then it's value.

program

String sname = "I think I just died";
String rating = "A"; /* rating is measuring from u to a (U,F,E,D,C,B,A) */
String worldRanking = "4";
String homeCountryRanking = "5";
String averageRanking = "4.5";
String genre = "pop";

    Map<String, String> description = new HashMap<>();
    description.put("SongName" , sname);
    description.put("Rating" , rating);
    description.put("WorldRank" , worldRanking);
    description.put("HomeRank" , homeCountryRanking);
    description.put("Average" , averageRanking);
    description.put("genre" , genre);
    for(Map.Entry<String, String> item : description.entrySet()){
        System.out.println(item.getKey() + " " +  item.getValue());
    }

home4

Hello,

I have the homework I submitted in my page. Take a look, I think it might help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants