Csci114 Task 1 Astrology a) Write an astrology program. The user types in a birt
ID: 673026 • Letter: C
Question
Csci114
Task 1
Astrology
a) Write an astrology program. The user types in a birthday, and the program responds with the sign and horoscope for that birthday. The month may be entered as a number from 1 to 12. Then enhance your program so that if the birthday is only one or two days away from an adjacent sign, the program announces that the birthday is on a “cusp” and also outputs the horoscope for that nearest adjacent sign. This program will have a long multiway branch. Make up a horoscope for each sign. Your program should include a loop that lets the user repeat this calculation until the user says she or he is done.
The horoscope signs and dates are:
Aries March 21 – April 19
Taurus April 20 – May 20
Gemini May 21 – June 21
Cancer June 22 – July 22
Leo July 23 – August 22
Virgo August 23 – September 22
Libra September 23 – October 22
Scorpio October 23 – November 21
Sagittarius November 22 – December 21
Capricorn December 22 – January 19
Aquarius January 20 – February 18
Pisces February 19 – March 20
b) Horoscope Signs of the same Element are most compatible. There are 4 Elements in astrology, and 3 Signs in each: FIRE (Aries, Leo, Sagittarius), EARTH (Taurus, Virgo, Capricorn, AIR (Gemini, Libra, Aquarius), WATER (Cancer, Scorpio, Pisces)
According to some astrologers, you are most comfortable with your own sign and the other two signs in your Element. For example, Aries would be most comfortable with other Aries and the two other FIRE signs, Leo and Sagittarius.
Modify your program from Programming1 to also display the name of the signs that will be compatible for the birthday.
Task 2:
Write a program to read a number and print the reverse of the number.
Input: 14567 as a single number
Output: 76541 as a single number
Task3 :
Online Quiz
Date and time will be announced in the class.
Grading scheme for task1 and task 2
Indentation and alignment of code, comments 5%
Presentation (screen layout) 10%
Validation of user input 10%
User friendliness 15%
Program functionality 50%
//Ps: we are using basic c++ (switch,do-while, if else...)
//Please Need Help now ,I would like the answers with descriptive comments
//Thank you
Explanation / Answer
//Header file section
#include<stdio.h>
//Begin main function
int main (void)
{
//Variable declartion
int month, date;
int start_date,start_month,end_date,end_month;
char continues;
do
{
//Inputting day
printf("Enter the day of month for your birthday ");
scanf("%d",&date);
//Inputting month
printf(" Entre month of your birthday ");
scanf("%d",&month);
//Check the condition
if(month>12 || date>31)
printf("Invalid input ");
{
start_date = 21;
end_date = 19;
start_month = 3;
end_month = 4;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : aries ");
if(date >= end_date-3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Taurus ");
else if(date <= start_date +3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Pieces ");
}
start_date = 20;
end_date = 20;
start_month = 4;
end_month = 5;
if(( month == start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("Your Sign is : Taurus ");
if(date >= end_date - 3 && month == end_month)
printf(" you are a cusp baby and with adjacent sign: Gemini ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Aries ");
}
start_date = 21;
end_date = 21;
start_month = 5;
end_month = 6;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : Gemini ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign:Cancer ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign:Taurus ");
}
start_date = 22;
end_date = 22;
start_month = 6;
end_month = 7;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : Cancer ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Leo ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Gemini ");
}
start_date = 23;
end_date = 22;
start_month = 7;
end_month = 8;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : Leo ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Virgo ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Cancer ");
}
start_date = 23;
end_date = 22;
start_month = 8;
end_month = 9;
if(( month == start_month && date>= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : Virgo ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Libra ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Leo ");
}
start_date = 23;
end_date = 22;
start_month = 9;
end_month = 10;
if(( month == start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("Your Sign is : Libra ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Scorpio ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Virgo ");
}
start_date =23;
end_date = 21;
start_month = 10;
end_month = 11;
if(( month== start_month && date>= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is :Scorpio ");
if(date >= end_date - 3 && month == end_month )
printf("you are a cusp baby and with adjacent sign: Sagitarius ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Libra ");
}
start_date =22;
end_date = 21;
start_month = 11;
end_month = 12;
if(( month== start_month && date>= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is :Sagittarius ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Sagitarius ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Libra ");
}
start_date = 22;
end_date = 19;
start_month = 12;
end_month = 1;
if(( month== start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("Your Sign is : Capricorn ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Aquarius ");
else if(date <= start_date +3 && month == start_month)
printf("you are a cusp baby and with adjacent sign:Sagittarius ");
}
start_date = 20;
end_date = 18;
start_month = 1;
end_month = 2;
if(( month== start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("Your Sign is : Aquarius ");
if(date>= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign: Pisces ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Capricorn ");
}
start_date = 19;
end_date = 20;
start_month = 2;
end_month = 3;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : Pieces ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby and with adjacent sign:Aries ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby and with adjacent sign: Aquarius ");
}
}
printf(" To repeat calculations for different variables then press 'y' or 'Y' ");
scanf("%c",&continues);
}
while(continues=='y' || continues =='Y');
return 0;
}//End main function
2)
//Header file section
#include<stdio.h>
//Begin main function
int main (void)
{
//Variable declartion
int month, date;
int start_date,start_month,end_date,end_month;
char continues;
do
{
//Inputting day
printf("Enter the day of month for your birthday ");
scanf("%d",&date);
//Inputting month
printf(" Entre month of your birthday ");
scanf("%d",&month);
//Check the condition
if(month>12 || date>31)
printf("Invalid input ");
{
start_date = 21;
end_date = 19;
start_month = 3;
end_month = 4;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("Your Sign is : aries,element is : AIR ");
if(date >= end_date-3 && month == end_month)
printf("you are a cusp baby,element is : EARTH and with adjacent sign: Taurus ");
else if(date <= start_date +3 && month == start_month)
printf("you are a cusp baby,element is : WATER and with adjacent sign: Pieces ");
}
start_date = 20;
end_date = 20;
start_month = 4;
end_month = 5;
if(( month == start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("element is : EARTH,Your Sign is : Taurus ");
if(date >= end_date - 3 && month == end_month)
printf(" you are a cusp baby,element is : AIR and with adjacent sign: Gemini ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby,element is : FIRE and with adjacent sign: Aries ");
}
start_date = 21;
end_date = 21;
start_month = 5;
end_month = 6;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("element is : AIR,Your Sign is : Gemini ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby,element is : EARTH and with adjacent sign:Cancer ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby ,element is : EARTH and with adjacent sign:Taurus ");
}
start_date = 22;
end_date = 22;
start_month = 6;
end_month = 7;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("element is : WAter, Your Sign is : Cancer ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby,element is : FIRE and with adjacent sign: Leo ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby,element is : AIR and with adjacent sign: Gemini ");
}
start_date = 23;
end_date = 22;
start_month = 7;
end_month = 8;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("element is : FIRE,Your Sign is : Leo ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby ,element is : EARTH and with adjacent sign: Virgo ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby, element is : Water and with adjacent sign: Cancer ");
}
start_date = 23;
end_date = 22;
start_month = 8;
end_month = 9;
if(( month == start_month && date>= start_date)||(month == end_month && date <= end_date))
{
printf("element is : EARTH,Your Sign is : Virgo ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby,element is : AIR and with adjacent sign: Libra ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby,Elements is : FIRE, and with adjacent sign: Leo ");
}
start_date = 23;
end_date = 22;
start_month = 9;
end_month = 10;
if(( month == start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("element is : AIR,Your Sign is : Libra ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby,element is : WATER and with adjacent sign: Scorpio ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby ,element is : EARTH and with adjacent sign: Virgo ");
}
start_date =23;
end_date = 21;
start_month = 10;
end_month = 11;
if(( month== start_month && date>= start_date)||(month == end_month && date <= end_date))
{
printf("element is : WATER,Your Sign is :Scorpio ");
if(date >= end_date - 3 && month == end_month )
printf("you are a cusp baby ,element is : FIRE and with adjacent sign: Sagitarius ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby , element is : AIR and with adjacent sign: Libra ");
}
start_date =22;
end_date = 21;
start_month = 11;
end_month = 12;
if(( month== start_month && date>= start_date)||(month == end_month && date <= end_date))
{
printf("element is : FIRE,Your Sign is :Sagittarius ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby ,element is : FIRE and with adjacent sign: Sagitarius ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby , element is : AIR and with adjacent sign: Libra ");
}
start_date = 22;
end_date = 19;
start_month = 12;
end_month = 1;
if(( month== start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("element is : EARTH,Your Sign is : Capricorn ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby, element is : AIR and with adjacent sign: Aquarius ");
else if(date <= start_date +3 && month == start_month)
printf("you are a cusp baby,element is : FIRE and with adjacent sign:Sagittarius ");
}
start_date = 20;
end_date = 18;
start_month = 1;
end_month = 2;
if(( month== start_month && date>= start_date)||(month ==end_month && date <= end_date))
{
printf("element is : WATER, Your Sign is : Aquarius ");
if(date>= end_date - 3 && month == end_month)
printf("you are a cusp baby ,element is : WATER and with adjacent sign: Pisces ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp baby,element is : EARTH and with adjacent sign: Capricorn ");
}
start_date = 19;
end_date = 20;
start_month = 2;
end_month = 3;
if(( month == start_month && date >= start_date)||(month == end_month && date <= end_date))
{
printf("element is : WATER,Your Sign is : Pieces ");
if(date >= end_date - 3 && month == end_month)
printf("you are a cusp baby,element is : FIRE and with adjacent sign:Aries ");
else if(date <= start_date + 3 && month == start_month)
printf("you are a cusp bab, element is : AIR and with adjacent sign: Aquarius ");
}
}
printf(" To repeat calculations for different variables then press 'y' or 'Y' ");
scanf("%c",&continues);
}
while(continues=='y' || continues =='Y');
return 0;
}//End main function
Task 2
//included Header
#include<iostream>
using namespace std;
int main() {
int number, reverse = 0;
cout<<"Input a Number to Reverse and press Enter: ";
cin>> number; // Taking Input Number in variable number
if( number!= 0 )
{
reverse = reverse * 10;
reverse = reverse + number%10;
number = number/10;
}
cout<<"New Reversed Number is: "<<reverse;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.