🔒 Closed Zodiac Sign Calculator - Conditions only

Status
Not open for further replies.

Tundra

Forum Guru
C++ / CPP syntax
Zodiac Calculator - Conditions Only

Ginawa ko to para sa kaybigan kong BS CS ng FEU.
Pero kung may BS CS din dito at need niyo to para sa module niyo, pwede niyo tong gawing reference.

Message niyo ako kapag need niyo yung mismong cpp file.
zodiac conditions only 1.webp
 
hindi pa po pinapagawa. kung ano palang daw po tinuturo, yun lang muna. kaya nakaka inis din po at the same time
 
ito lang ang code nyan (~15 lines), bakit ang dami mo pang if else condition..
wala akong codeblocks ngayon,, so java code muna(almost same lang naman yung basic syntax..)

Java:
public class Zodiac {
 
    static int month = 3; //March
    static int day = 8; //March 8
 
    static final String[] Zodiac = {"Aquarious", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn"};
    static final int date[] = {20,19,21,20,21,21,23,23,23,23,22,22};
    public static void main(String[] args) {
        System.out.println(mysign(month, day));    
    }
 
    static String mysign(int month, int day){
        if (day < date[month - 1]) {
            return Zodiac[(((month - 1) - 1) + Zodiac.length)%Zodiac.length];
        }else{
            return Zodiac[month - 1];
        }    
    }
}
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 566
    Views
  • 5
    Participants
Last reply from:
cetmyeval69

Trending Topics

Online now

Members online
1,097
Guests online
1,500
Total visitors
2,597

Forum statistics

Threads
2,294,318
Posts
29,090,258
Members
1,207,270
Latest member
hatefuld13
Back
Top