- #1
- 170
- 2
Hey so I have to write a program that does the following for my class ( Object oriented programing 1, so basic stuff really...)
An online music and apps store offers all apps for 3$ each and all songs for 7$ each. The store
requires members to prepay any amount of money they wish, and then download as many apps
or as many songs accordingly. You are required to write a program that would ask the user for
the amount that he/she will pay, then display two messages indicating:
- the maximum number of apps that can be downloaded, and how much funds will remain
in the account after that, if any.
- the maximum number of songs that can be downloaded, the number of apps that can be
downloaded after that if funds allow, and how much funds will remain in the account
after that, if any.
Notice the parenthesis in app(s) and song(s) in the output.
And I wrote this, but I have a few question about what I wrote ...
"
public class MusicStore
{ double prePay;
prePay = x;
int. songs, apps;
Final int. Songs=3$ , apps=7$
public static void main (String arg[])
{ system.out.println("How much money do you wish to prepay?")"
Keep in mind I am not done. My first (1) question was whether or not I have to define my variables and constants before or after my main method? ( and why if anyone can explain) . Secondly, I don't know how to ask / allow the user to input a number after a question. Finally, for my system output, would I be better using "How much money do you wish to prepay?" or use the define variable.
Really sorry if this is a mess, it's my first time doing this alone!
An online music and apps store offers all apps for 3$ each and all songs for 7$ each. The store
requires members to prepay any amount of money they wish, and then download as many apps
or as many songs accordingly. You are required to write a program that would ask the user for
the amount that he/she will pay, then display two messages indicating:
- the maximum number of apps that can be downloaded, and how much funds will remain
in the account after that, if any.
- the maximum number of songs that can be downloaded, the number of apps that can be
downloaded after that if funds allow, and how much funds will remain in the account
after that, if any.
Notice the parenthesis in app(s) and song(s) in the output.
And I wrote this, but I have a few question about what I wrote ...
"
public class MusicStore
{ double prePay;
prePay = x;
int. songs, apps;
Final int. Songs=3$ , apps=7$
public static void main (String arg[])
{ system.out.println("How much money do you wish to prepay?")"
Keep in mind I am not done. My first (1) question was whether or not I have to define my variables and constants before or after my main method? ( and why if anyone can explain) . Secondly, I don't know how to ask / allow the user to input a number after a question. Finally, for my system output, would I be better using "How much money do you wish to prepay?" or use the define variable.
Really sorry if this is a mess, it's my first time doing this alone!