c# - Using an integer value from a class in another class -
please trying values class:
class movierating { // block of code user ratings of movie public void detailsrate() { console.writeline("\n rate acting on scale of 0 5"); rateacting = int.parse(console.readline()); console.writeline("\n rate music of movie on scale of 0 5"); ratemusic = int.parse(console.readline()); console.writeline("rate cinematography of movie on scale of 0 5"); console.writeline("rate plot of movie on scale of 0 5"); console.writeline("rate duration of movie on scale of 0 5"); rateduratn = int.parse(console.readline()); } }
and use in class:
class executerating { public void overallrate() { movierating movrate = new movierating(); int rateact = movrate.rateacting; int ratemus = movrate.ratemusic; int ratecin = movrate.ratecinema; int rateplot = movrate.rateplot; int ratedur = movrate.rateduratn; int totrate = rateact + ratemus + ratecin + rateplot + ratedur; console.writeline("total rate is- {0}", totrate); }
but discovered no value entering class
'executerating'
please missing? thank in advance.
it looks need call detailsrate()
in overallrate()
, i.e.
... movierating movrate = new movierating(); movrate.detailsrate(); ...
Comments
Post a Comment