I have to write a code that prompts the user for the name of an exoplanet, then prompts them for more data on that exoplanet referencing the given name.
if trueexoplanet = input('what is the name of exoplanet?\n ','s');mass = input('what is the estimated mass of ',exoplanet,' (kg)?\n ');radius = input('what is the estimated radius of the ',exoplanet,' (km)?\n ')*1000;specimen_mass = input('what is the mass of the specimen (kg)?\n ');specimen_weight = (6.67408*10^11)*((mass*specimen_mass)/(radius^2));fprintf( 'On ',exoplanet,', it would weigh approximately %.1f Newtons.\n',specimen_weight)end
As shown in the code I have created a variable for the input of the given name, but I can't figure out how to get the following input functions to reference that given name. When I have the variable referenced as shown I get an error of "too many arguments."
Best Answer