Shaik Irfan

Shaik Irfan

  • NA
  • 7
  • 3.4k

.NET

Jun 8 2014 2:12 AM
Question :
Q.Write a program in any of your favorite programming language.
This similar to product rating.
The input is X ( X is a decimal number ,which is belongs to {0, 0.5, 1, 1.5, 2, .., MAX}) 
The output should be a string that consists of "FS","HS","FE" (represents full star, half star, full empty)
X Can be any decimal number ( multiples of 0.5 )
MAX Can be any number.
Examples:

if user gives input as 1.5, 5 , then output should be "FS,HS,FE,FE,FE" (which means fullstar,half star, full empty, full empty,full empty)
if user gives input as 0 , 5 , then output should be "FE,FE,FE,FE,FE" (which means five full emptys)
if user gives input as 3 , 5 then output should be "FS,FS,FS,FE,FE" (which denotes 3 fullstars , 2emptys )
if user gives input as 5 , 5 then output should be "FS,FS,FS,FS,FS" (which denotes 5 fullstars )
if user gives input as X=1.5, MAX=8 , then output should be "FS,HS,FE,FE,FE,FE,FE,FE" 
(which means fullstar,half star, full empty, full empty,full empty, full empty, full empty,full empty)
if user gives input as 7 , 10 , then output should be "FS,FS,FS,FS,FS,FS,FS,FE,FE,FE"
if user gives input as 8.5 , 12 then output should be "FS,FS,FS,FS,FS,FS,FS,FS,HS,FE,FE,FE"
if user gives input as 11.5 , 15 then output should be "FS,FS,FS,FS,FS,FS,FS,FS,FS,FS,FS,HS,FE,FE,FE,FE"

Answers (5)