I don't know what a K-expression is, but it looks like you just need to write a program that reads a double, an operator (char), and another double, performs the operation on them, and prints the output.
You need to try yourself before you'll get much more help. Post your code if you get stuck.
Sorry I made a mistake. Cross out Sample 2. The question requires me to input 2 positive integers. But I don't know about how to determine whether a number is an integer or double. Please help me with this part. Thanks! :)
What's wrong with posting code to help someone? In order to be successful in their course they would have to understand what I coded there, so, in reality I'm just presenting him with the core idea of what they need to do.
@Group of Eight
i don't know if you're naive or just acting naive. no offence.
where i come from, if a professor wants a homework done, he never asks the student about it, he assumes that the student solved it himself and understands every word in it.
the case isn't always that simple, there are some student who steal solutions in various ways and present it to the professor, and get the marks for free.
in exam, they pass because they know how to cheat every thing.
people CAN pass a course they don't understand.
anyway, it's your choice to solve the whole homework for someone.
Sakudo please don't misunderstand me, i wasn't talking about you, i was talking in general.
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
In programming, work later in the course is often build on top of lessons learned in previous assignments. By doing the work for him this time, he can just turn the code in as-is without having learned anything from the assignment, and then he'll be ill-prepared for the next assignment where it's assumed he learned certain concepts from this one.
You should not give out full solutions, but rather help guide the person to finding the solution themselves.
You're right that giving code can help... but you should give example code that isn't exactly on point. Something they can't directly copy. That way they have to understand it and adapt it to what they're doing.