What's new

Help Bat po kaya failed to?

Panto

Honorary Poster
Established
Joined
Dec 3, 2021
Posts
364
Reaction
83
Points
179
nag papract ako mag oop yan kasi topic namin now kaya nag dl ako jk at ide bat po ganto ayaw mag run? tama naman code ko
Screenshot (2).png
Screenshot (3).png
 

Attachments

Hello! I'm here to help you with your object-oriented programming concern. It would be great if you can share the code that you're having trouble with so I can take a look and provide you with some insights on why it may not be running as expected. Feel free to paste the code here so we can work on it together.
 
Mukhang galing kang c++ ah.
1. Tanggalin mo yung space before ng parenthesis when calling a function/method.
Example: This same goes sa scanner mo.
Instead of: new_pract = new new_pract ()
Do: new_pract = new new_pract()
2. You can name your scanner with in instead of cin. Tho, ikaw naman bahala pero ito yung lagi kong ginagawa since mabilis.
3. Naming variables and classes: Sa variable at function, gumamit ka ng camel case: newPract = new newPract() and sa classes naman, gumamit ka ng Pascal case: Practice, ThisIsMyClass
4. You can use System.out.print sa mga kasunod is input para walang new line
5. Maeencounter mo yung error sa magkasunod na input na nextInt at nextLine and hindi mababasa yung isa. Yung solution is lagyan mo muna ng nextLine() after ng nextInt().

int num = in.nextInt();
in.nextLine();
String text = in.next();
 
Tingnan mo yung project explorer mo sa left side. yung "Pract.java" mo nasa loob ng "default package" dapat yan nasa loob ng "com.mycompany.pract". So ililipat mo lang yan via dragging it. Tapos type mo ito sa tuktok ng file (sa pinakaunahan)
Java:
package com.mycompany.pract;
 
Mukhang galing kang c++ ah.
1. Tanggalin mo yung space before ng parenthesis when calling a function/method.
Example: This same goes sa scanner mo.
Instead of: new_pract = new new_pract ()
Do: new_pract = new new_pract()
2. You can name your scanner with in instead of cin. Tho, ikaw naman bahala pero ito yung lagi kong ginagawa since mabilis.
3. Naming variables and classes: Sa variable at function, gumamit ka ng camel case: newPract = new newPract() and sa classes naman, gumamit ka ng Pascal case: Practice, ThisIsMyClass
4. You can use System.out.print sa mga kasunod is input para walang new line
5. Maeencounter mo yung error sa magkasunod na input na nextInt at nextLine and hindi mababasa yung isa. Yung solution is lagyan mo muna ng nextLine() after ng nextInt().

int num = in.nextInt();
in.nextLine();
String text = in.next();
opo galing c++ nag transfer kasi tapos iba pala language nila ayun btw thanks boss

Tingnan mo yung project explorer mo sa left side. yung "Pract.java" mo nasa loob ng "default package" dapat yan nasa loob ng "com.mycompany.pract". So ililipat mo lang yan via dragging it. Tapos type mo ito sa tuktok ng file (sa pinakaunahan)
Java:
package com.mycompany.pract;
thanks po
 
Back
Top