Need Help with java ASCII art - can anyone try this and then talk me through it. Please and Thanks:D

No description
17 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @StremesJ! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
StremesJ
StremesJOP2mo ago
@ponchisao326 hello again want a challenge 😄
ponchisao326
ponchisao3262mo ago
hahhahah let me check
StremesJ
StremesJOP2mo ago
tysm - dont worry if your busy tho
ponchisao326
ponchisao3262mo ago
what do you have at the moment ?
StremesJ
StremesJOP2mo ago
nothing i got the void display {} but like switch case and doing ascii art is so hard
ponchisao326
ponchisao3262mo ago
Can you pass the exercise itself through here the plain text
StremesJ
StremesJOP2mo ago
ok
Phloof_boll
Phloof_boll2mo ago
Program 4. Seven Segment Display (20%) In the file SevenSegment.jsh, write a method with the signature: void display(int n) that, given a number, displays ASCII art of that number in the style of an electronic “seven segment display”. For example: display(28); -- -- | | | -- -- | | | -- -- You may assume the number is a non-negative Java int. Hints:  Use n % 10 to get the right-most digit of a number. For example, 123456 % 10 == 6.  Use n / 10 to chop off the right-most digit of a number. For example, 123456 / 10 == 12345. To help your program draw the ASCII art, you should use the following method that, given a digit d and a line number n (from 1 to 5), returns a String representing line n of digit d.
String ssd(int d, int n) {
switch ((d*10)+n) {
case 1: case 5: case 21: case 23: case 25: case 31: case 33: case 35:
case 43: case 51: case 53: case 55: case 61: case 63: case 65: case 71:
case 81: case 83: case 85: case 91: case 93: case 95:
return " -- ";
case 24: case 52: case 62:
return "| ";
case 12: case 14: case 22: case 32: case 34: case 44: case 54: case 72:
case 74: case 94:
return " | ";
case 2: case 4: case 42: case 64: case 82: case 84: case 92:
return "| | ";
default: return " ";
}
}
String ssd(int d, int n) {
switch ((d*10)+n) {
case 1: case 5: case 21: case 23: case 25: case 31: case 33: case 35:
case 43: case 51: case 53: case 55: case 61: case 63: case 65: case 71:
case 81: case 83: case 85: case 91: case 93: case 95:
return " -- ";
case 24: case 52: case 62:
return "| ";
case 12: case 14: case 22: case 32: case 34: case 44: case 54: case 72:
case 74: case 94:
return " | ";
case 2: case 4: case 42: case 64: case 82: case 84: case 92:
return "| | ";
default: return " ";
}
}
This message has been formatted automatically. You can disable this using /preferences.
StremesJ
StremesJOP2mo ago
this?
ponchisao326
ponchisao3262mo ago
yes, but if you can pass it through a document would be better it's just because I can't see it that well on the photo
StremesJ
StremesJOP2mo ago
oki give me 3 mins
ponchisao326
ponchisao3262mo ago
okay
StremesJ
StremesJOP2mo ago
there you go
ponchisao326
ponchisao3262mo ago
ty
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server