+ 1

I need to write a prohram that prompts user for his income and display the result on the screen.

The first part asks for his income. There is a \t before the phrase "Your monthly income and a single space after ':'. So you have " Your monthly income is: " The user needs to provide his or her income as a float. The next part is to display the result to the screen. So you have something like "Your income is: $ 1010.99" //Output should look like this... Your monthly income: 1010.99 Your income is: $ 1010.99. There needs to be one space between the colon and the dollar sign. The money is right alligned to 9 spaces from the dollar sign. Can anyone help with this, please????

7th May 2019, 5:58 AM
Joshua Olaoye
Joshua Olaoye - avatar
19 Respostas
+ 4
Updated And when you run the code, you type the value. It will update to that value.
7th May 2019, 4:48 PM
Kartik
Kartik - avatar
+ 4
Updated
7th May 2019, 4:57 PM
Kartik
Kartik - avatar
+ 3
Your code??? It is suggested to try by yourself and if you get some error, you post the code here... And we can help you then...
7th May 2019, 6:03 AM
Kartik
Kartik - avatar
+ 3
7th May 2019, 12:32 PM
Kartik
Kartik - avatar
+ 3
What do you mean? Give an example...
7th May 2019, 4:43 PM
Kartik
Kartik - avatar
+ 2
You are a boss.
7th May 2019, 4:50 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 2
Yes.
7th May 2019, 4:52 PM
Kartik
Kartik - avatar
+ 2
Can I get to know you more?
7th May 2019, 5:37 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
Ok, I am not with my laptop.... So when I get back home, I will post the errors instead. I basically have issues translating the errors I get
7th May 2019, 6:07 AM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
This is the code and the errors...
7th May 2019, 11:21 AM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
#include <iostream> using namespace std; int main() { int monthlyIncome; floatmonthlyIncome = 1010.99; cout <<"\tYour monthly income: " <<endl; cin >> monthlyIncome; cout <<"Your monthly income is:
quot;; cout << monthlyIncome << endl; return 0; }
7th May 2019, 12:04 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
So please, what am I doing wrong???
7th May 2019, 12:04 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
Thank you so much.....
7th May 2019, 4:40 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
What if I want the output to display a digit, where do I insert that
7th May 2019, 4:41 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
Unlike the output of your code, it displays: Your monthly income: Your monthly income is: $ 0
7th May 2019, 4:44 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
I want to add a value there instead of $0
7th May 2019, 4:45 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
Also, you know I could also choose to use setw() instead of .width.....
7th May 2019, 4:51 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
If setw() was my choice, how would I input it???
7th May 2019, 4:51 PM
Joshua Olaoye
Joshua Olaoye - avatar
+ 1
You just saved my life..
7th May 2019, 5:37 PM
Joshua Olaoye
Joshua Olaoye - avatar