Wednesday, August 21, 2019

day 2



PROBLM NO :1
An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.
Write a program to find all Armstrong number in the range of 0 and 999.


PROBLM NO :2
Project predictor
In the three-field system the sequence of field use involved an autumn planting of grain (wheat, barley or rye) and a spring planting of peas, beans, oats or barley. The third was left fallow, in order to allow the soil of that field to regain its nutrients.

The 3 durations(4 months each) are,
Duration 1: 1-4 (all inclusive)
Duration 2: 5-8 (all inclusive)
Duration 3: 9-12 (all inclusive)

The 2 crops that were used are,
Crop 1: Winter Wheat
Crop 2: Beans

The initial crops in three fields at month 1are,
Field 1: Winter Wheat
Field 2: Beans
Field 3: Left Fallow

Given the month number and field number, write a program to print the crop name.

Input Format:
The first input is an integer corresponds to month number.
The second input is an integer corresponds to field number.

Output Format:
The output is the string.

Sample Input 1:
5
2
Sample Output 1:
Winter Wheat

Sample Input 2:
2
3
Sample Output 2:
Left Fallow

Sample Input 3:
2
2
Sample Output 3:
Beans
PROBLEM NO : 3
Crop cultivation strategy
 
If a crop is grown for once, the fertility of the soil reduces by 30. After cultivation, if the land is left free for one month, the fertility increases by a factor of 2. If the fertility becomes 0, the crop cannot be grown further. Write a program to get the initial fertility and get the number of months the land is left free after every cultivation and find the number of times the crops are successfully grown, before the fertility becomes 0.

Note 1: If the fertility becomes 0 in the middle of the growth of crop, the crop stops growing.
Note 2: Stop getting the input if the fertility becomes 0.

Input Format:
First input is an integer that corresponds to the initial fertility of the soil.
Next inputs are number of months the land is left free after every cultivation.
Output Format:
Number of times the crops are grown successfully.

Sample Input:
35
3
1
Sample Output:
2


Explanation:
35->after first cultivation fertility become 5
3-> after 3 months the fertility becomes 40( 5*2 = 10, 10*2 = 20, 20*2 = 40); After second cultivation the fertility becomes 10
1-> after 1 month the fertility becomes 20; In the middle of the crop growth the fertility becomes 0, so stop.
So the total number of successful cultivations = 2.

day 1

Wednesday, August 14, 2019

Consider the following information about a university database:
Professors have an SSN, a name, an age, a rank, and a research specialty.

Projects have a project number, a sponsor name (e.g., NSF), a starting date, an
ending date, and a budget.

Graduate students have an SSN, a name, an age, and a degree program (e.g., M.S.
or Ph.D.).

Each project is managed by one professor (known as the project’s principal investigator).

Each project is worked on by one or more professors (known as the project’s
co-investigators).

Professors can manage and/or work on multiple projects.

Each project is worked on by one or more graduate students (known as the
project’s research assistants).

When graduate students work on a project, a professor must supervise their work
on the project. Graduate students can work on multiple projects, in which case
they will have a (potentially different) supervisor for each one.

Departments have a department number, a department name, and a main office.

Departments have a professor (known as the chairman) who runs the department.

Professors work in one or more departments, and for each department that they
work in, a time percentage is associated with their job.

Graduate students have one major department in which they are working on their
degree.

Each graduate student has another, more senior graduate student (known as a
student advisor) who advises him or her on what courses to take.




 DBMS class materials click here to join the class room  click here  https://www.youtube.com/channel/UC93Sqlk_tv9A9cFv-QjZFAQ