Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add hexadecimal to binary and hexadecimal to decimal conversions#1328

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@MohamedBechir
Copy link
Contributor

@MohamedBechirMohamedBechir commentedMay 25, 2020
edited
Loading

I have noticed that some conversions are missing, so I started by adding the hexadecimal to decimal and the hexadecimal to binary ones, if you approve it I can work on the other ones.
My code converts a hexadecimal number to a decimal one.

NB: I am new to the software engineering community. I did my best and if anything is wrong with my code I can change it anytime, I am eager to learn more.

@MohamedBechirMohamedBechir changed the titleAdd HexadecimalToDecimal conversionAdd HexadecimalToBinary conversionMay 25, 2020
@MohamedBechirMohamedBechir changed the titleAdd HexadecimalToBinary conversionAdd hexadecimal to decimal conversionMay 25, 2020
@MohamedBechirMohamedBechir changed the titleAdd hexadecimal to decimal conversionAdd hexadecimal to binary conversionMay 25, 2020
Copy link
ContributorAuthor

@MohamedBechirMohamedBechir left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I am sorry the first commit is hexadecimal to decimal conversion and the second one is hexadecimal to binary conversion ( the second commit message is false)
Sorry again

@MohamedBechirMohamedBechir changed the titleAdd hexadecimal to binary conversionAdd hexadecimal to binary and hexadecimal to decimal conversionsMay 25, 2020
package com.conversions;

public class HexadecimalToBinary {
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Your code fails in case of floating point conversion, 'ABC.BC' try doing it for real values also

MohamedBechir reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good work but you missed out in the 2nd file.

@MohamedBechir
Copy link
ContributorAuthor

@deadshotsb Okay, thank you for your feedback I will fix it now.

@MohamedBechir
Copy link
ContributorAuthor

@deadshotsb I have just fixed the requested changes can you check it and give me your feedback?
Thank you

package com.conversions;

public class HexadecimalToBinary {
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good work but you missed out in the 2nd file.

* @return decimal number
*/
public String hexToDecimal(String hexaStr) {
String hexaNumbers = "0123456789ABCDEF";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Your code fails in case of "AB.CD"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

because from the point you must multiply for 1/16, the potency start to be negative

Copy link
ContributorAuthor

@MohamedBechirMohamedBechirMay 26, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@nippur101
Yes, that's what I did, thank you

@MohamedBechir
Copy link
ContributorAuthor

@deadshotsb you are right sir, I'll do it now! Sorry

@deadshotsb
Copy link
Member

@MohamedBechir We are all developers no sir and boss please

MohamedBechir reacted with thumbs up emoji

@MohamedBechir
Copy link
ContributorAuthor

MohamedBechir commentedMay 25, 2020
edited
Loading

@deadshotsb can you explain more what I am supposed to do? A.B => 10.11 or A.B => 10.6875? thank you

@deadshotsb
Copy link
Member

A.B = 16^(0)*(10) + 16^(-1) * (11)

MohamedBechir reacted with thumbs up emoji

@MohamedBechir
Copy link
ContributorAuthor

@deadshotsb I just fixed it, take a look. Thank you again

@deadshotsbdeadshotsb merged commit9f8abb0 intoTheAlgorithms:DevelopmentMay 25, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

2 more reviewers

@nippur101nippur101nippur101 left review comments

@deadshotsbdeadshotsbdeadshotsb approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@MohamedBechir@deadshotsb@nippur101

[8]ページ先頭

©2009-2025 Movatter.jp