Write a C++ program to display Pascal's triangle.
Test data:
Input the number of rows : 5
Expected output:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Write a program in C++ to find the number ang sum in all integer between 100 and 200 which are divisible by 9.
Expected output:
Number between 100 and 200, divisible by 9.
108 117 126 135 144 153 162 171 180 189 198
In the farming Game, we define a class named Poultry. A poultry has five attributes: name, num, weight, Maxweight and price. Their names include "Chickens", "Rabbits", and "Pigs". representing three types of animals in a farm. In Poultry, "num" means the number of a specific animal that can be sold, and "weight" means the weight of a young animal. In particular, the weight of an animal can increase if it eats food by a member function "eatFood" defined in the class. Once the weight reaches Maxweight, it will cause the animal of the specific type become mature and old enough to be sold, and its price is defined by the variable "price" and the num will also be increased by 1. It is worth mentioning that only one young animal for each type is available in the farm for feeding. For example, after the young rabbit becomes mature enough to be sold, another young rabbit will come out and begin to be fed. In a poultry, "name"-Chickens, "num"-2, "weight"=1. "Maxweight"-7, "price"-30, mean that in your farm.
Is It You, Cody?
by CodeChum Admin
Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong". It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct.
Now, will you take on this task?
Input
A line containing four one-letter strings separated by a space.
c·O·D·y
Output
A line containing a string.
Correct
Enter the subtotal and gratuity rate: 10 12 The gratuity is $1.2 and total is $11.2
3. A new taxi service based on electric vehicles is offering
services within a metro city. Following is the fare chart
including the type of taxi used to commute and price per
kilometer. Write a java program to calculate total fare
depending on the distance travelled in kilometers.
Note: Use if Control statement
Type Fare
Micro Php15.00/Km
Macro Php35.50/Km
Shared Php8.50/Km
All years that are evenly divisible by 400 or are evenly
divisible by four and not evenly divisible by 100 are
leap years. For example, since 1600 is evenly divisible
by 400, the year is was a leap year. Similarly, since
1988 is evenly divisible by four but not by 100, the year
1988 was also a leap year. Using this information write
a Java method that accepts the year as user input,determines if the year is a leap year, and displays an
appropriate message that tells the user if the entered
year is or is not a leap year.
note: use if control statement
Write a java program to convert car consumption from one
unit to another. Offer the user the choice of either
conversion, kpl to mpg or mpg to kpl. The interface
should be:
PREFERRED CONVERSION:
1. kpl to mpg
2. mpg to kpl
Enter your choice: 2
Enter miles per gallon value: mpg_value
The equivalent kilometers per liter is: kpl_value
Use the constants 1 mile = 1609 meters and 1 gallon = 3.785
liters.
Useful formula:
mpg = (kpl / 1.609) * 3.785
kpl = (mpg * 1.609) / 3.785
note: use switch control statement
A complex number is a number in the form a+bi, where a and b are real numbers and i is
(square root of -1).
The numbers a and b are known as the real part and imaginary part of the complex number, respectively. You can perform addition, subtraction, multiplication, and division for complex numbers using the following formulas:
a+bi+c+di = (a + c) + (b+d)i
a+bi (c+di) = (ac) + (b-d)i
(a + bi)*(c+di) = (ac-bd) + (bc + ad)i (a + bi)/(c+di) = (ac+bd)/(c² +d²) + (bc-ad)i/(c² +d²)
You can also obtain the absolute value for a complex number using the following formula:
|a + bil= √a² + b²
(A complex number can be interpreted as a point on a plane by identifying the (a,b) values as the coordinates of the point. The absolute value of the complex number corresponds to the distance of the point to the origin)
Design a class named Complex for representing complex numbers and the methods add, subtract,
multiply, divide, and abs for performing complex-number operations, and override toStrin
Create a program like SIMSIMI in the playstore that would ask the user at least 10-20 question. The program must interact with user using details about the user like name, birthday, etc.
A list box can be bound or connected directly to a data table. true or false