Tuesday, January 20, 2015

Day 17: Netbeans and ?

I was faced with a rather queer problem today where compilation is successful but I got a compilation error at runtime. This is some weird behaviour of Netbeans and not my code thank goodness.

http://stackoverflow.com/questions/2333285/java-lang-runtimeexception-uncompilable-source-code-what-can-cause-this

On a lighter note, I felt sorry for an over-enthu student who was discussing with my friend his ideas which were progressively proven to be existing much to his dismay. This is a classic feeling everyone has.


Tuesday, January 6, 2015

Day 16: Input/Output

Implementing [Bakman[2007]]

Question 1

Input:
David has 5 apples. He gave apples to Ruth. David has 3 apples. How many apples did David give?

Output:
=================================================
Question:
David has 5 apples. He gave apples to Ruth. David has 3 apples. How many apples did David give?
=================================================
Simplified Question:
David  has 5 apples.
David  gave apples to Ruth.
David  has 3 apples.
How many apples  did David give.

==================================================
Solution:
David forfeit 2 apple

Question 2

Input:
Ruth has 3 dolls. Ann has 4 dolls. How many dolls do Ruth and Ann have altogether?

Output:
===================================================
Question:
Ruth has 3 dolls. Ann has 4 dolls. How many dolls do Ruth and Ann have altogether?
===================================================
Simplified Question:
Ruth  has 3 dolls.
Ann  has 4 dolls.
How many dolls  do Ruth and Ann have altogether.

===================================================
Solution:
altogether Ann and Ruth has 7 doll


Question 3

Input:
Sara has 6 flowers. Clara has 3 flowers more than Sara. How many flowers does Clara have ?

Output:
===================================================
Question:
Sara has 6 flowers. Clara has 3 flowers more than Sara. How many flowers does Clara have ?
===================================================
Simplified Question:
Sara  has 6 flowers.
Clara  has 3 flowers more than Sara.
How many flowers  does Clara have.

===================================================
Solution:
Clara has 9 flower


Question 4

Input:
Ruth had 3 apples. She put 2 apples into a basket. How many apples are there in the basket now, if in the beginning there were 4 apples in the basket?

Output:
===================================================
Question:
Ruth had 3 apples. She put 2 apples into a basket. How many apples are there in the basket now, if in the beginning there were 4 apples in the basket?
===================================================
Simplified Question:
Ruth  had 3 apples.
Ruth  put 2 apples into a basket.
How many apples  are there in the basket now.
There  were 4 apples in the basket.

===================================================
Solution:
6 apple in basket

Question 5

Input:
Ruth had 5 nuts more than Dan had. Ruth gave Dan 3 nuts. Dan gave 2 nuts to David. Now Dan has 4 nuts and David has 6 nuts. How many nuts does Ruth have now?

Output:
===================================================
Question:
Ruth had 5 nuts more than Dan had. Ruth gave Dan 3 nuts. Dan gave 2 nuts to David. Now Dan has 4 nuts and David has 6 nuts. How many nuts does Ruth have now?
===================================================
Simplified Question:
Ruth  had 5 nuts more than Dan had.
Ruth  gave Dan 3 nuts.
Dan  gave 2 nuts to David.
Dan  has 4 nuts.
David  has 6 nuts.
How many nuts  does Ruth have now.

====================================================
Solution:
Dan has 6 nut
Dan had 3 nut
Ruth had 8 nut
Ruth has 5 nut
David had 4 nut

[It provides all possible answers apart from the asked question]

Question 6

Input:
David gave 3 candies to Ruth, and John gave 2 candies to David. Now David has 4 candies more than Ruth has. How many candies does David have now, if Ruth had 7 candies in the beginning?

Output:
==================================================
Question:
David gave 3 candies to Ruth, and John gave 2 candies to David. Now David has 4 candies more than Ruth has. How many candies does David have now, if Ruth had 7 candies in the beginning?
===================================================
Simplified Question:
David  gave 3 candies to Ruth.
John  gave 2 candies to David.
David  has 4 candies more than Ruth has.
How many candies  does David have now.
Ruth  had 7 candies in the beginning.

====================================================
Solution:
Ruth has 10 candy
David had 15 candy
David has 12 candy
David has 14 candy

[This shows the progression of David's gains and losses]