how to Align values
%price of each
TV_price = 20000.00;
LAPTOP_price = 40000.00;
SPEAKER_price = 6000.00;
MOUSE_price = 1000.00;
KEYBOARD_price = 3000.00;
%get input from user
TV = input(‘How many TVs were sold? ‘);
LAPTOP = input(‘How many Laptops were sold? ‘);
SPEAKER = input(‘How many Speakers were sold? ‘);
MOUSE = input(‘How many Computer Mouse were sold? ‘);
KEYBOARD = input(‘How many Keyboards were sold? ‘);
fprintf("n—————————————————–n");
%print bill
%Display
fprintf("nQTYtDESCRIPTIONttUNIT PRICEtTOTAL PRICEn");
fprintf("n—t———–tt———t———n");
fprintf("%dtTVtt%.2ft%.2fn",TV,TV_price,TV*TV_price);
fprintf("%dtLAPTOPtt%.2ft%.2fn",LAPTOP,LAPTOP_price,LAPTOP*LAPTOP_price);
fprintf("%dtSPEAKERtt%.2ftt%.2fn",SPEAKER,SPEAKER_price,SPEAKER*SPEAKER_price);
fprintf("%dtMOUSEtt%.2ftt%.2fn",MOUSE,MOUSE_price,MOUSE*MOUSE_price);
fprintf("%dtKEYBOARDt%.2ftt%.2fn",KEYBOARD,KEYBOARD_price,KEYBOARD*KEYBOARD_price);
total = (TV*TV_price)+(LAPTOP*LAPTOP_price)+(SPEAKER*SPEAKER_price)+(MOUSE*MOUSE_price)+(KEYBOARD*KEYBOARD_price);
tax = (total/100)*8.25;
fprintf("ttttt———-n");
fprintf("tttSUBTOTALt%.2fn",total);
fprintf("tttTAXEStt%.2fn",tax)
fprintf("tttTOTALtt%.2fn",total+tax);%price of each
TV_price = 20000.00;
LAPTOP_price = 40000.00;
SPEAKER_price = 6000.00;
MOUSE_price = 1000.00;
KEYBOARD_price = 3000.00;
%get input from user
TV = input(‘How many TVs were sold? ‘);
LAPTOP = input(‘How many Laptops were sold? ‘);
SPEAKER = input(‘How many Speakers were sold? ‘);
MOUSE = input(‘How many Computer Mouse were sold? ‘);
KEYBOARD = input(‘How many Keyboards were sold? ‘);
fprintf("n—————————————————–n");
%print bill
%Display
fprintf("nQTYtDESCRIPTIONttUNIT PRICEtTOTAL PRICEn");
fprintf("n—t———–tt———t———n");
fprintf("%dtTVtt%.2ft%.2fn",TV,TV_price,TV*TV_price);
fprintf("%dtLAPTOPtt%.2ft%.2fn",LAPTOP,LAPTOP_price,LAPTOP*LAPTOP_price);
fprintf("%dtSPEAKERtt%.2ftt%.2fn",SPEAKER,SPEAKER_price,SPEAKER*SPEAKER_price);
fprintf("%dtMOUSEtt%.2ftt%.2fn",MOUSE,MOUSE_price,MOUSE*MOUSE_price);
fprintf("%dtKEYBOARDt%.2ftt%.2fn",KEYBOARD,KEYBOARD_price,KEYBOARD*KEYBOARD_price);
total = (TV*TV_price)+(LAPTOP*LAPTOP_price)+(SPEAKER*SPEAKER_price)+(MOUSE*MOUSE_price)+(KEYBOARD*KEYBOARD_price);
tax = (total/100)*8.25;
fprintf("ttttt———-n");
fprintf("tttSUBTOTALt%.2fn",total);
fprintf("tttTAXEStt%.2fn",tax)
fprintf("tttTOTALtt%.2fn",total+tax); %price of each
TV_price = 20000.00;
LAPTOP_price = 40000.00;
SPEAKER_price = 6000.00;
MOUSE_price = 1000.00;
KEYBOARD_price = 3000.00;
%get input from user
TV = input(‘How many TVs were sold? ‘);
LAPTOP = input(‘How many Laptops were sold? ‘);
SPEAKER = input(‘How many Speakers were sold? ‘);
MOUSE = input(‘How many Computer Mouse were sold? ‘);
KEYBOARD = input(‘How many Keyboards were sold? ‘);
fprintf("n—————————————————–n");
%print bill
%Display
fprintf("nQTYtDESCRIPTIONttUNIT PRICEtTOTAL PRICEn");
fprintf("n—t———–tt———t———n");
fprintf("%dtTVtt%.2ft%.2fn",TV,TV_price,TV*TV_price);
fprintf("%dtLAPTOPtt%.2ft%.2fn",LAPTOP,LAPTOP_price,LAPTOP*LAPTOP_price);
fprintf("%dtSPEAKERtt%.2ftt%.2fn",SPEAKER,SPEAKER_price,SPEAKER*SPEAKER_price);
fprintf("%dtMOUSEtt%.2ftt%.2fn",MOUSE,MOUSE_price,MOUSE*MOUSE_price);
fprintf("%dtKEYBOARDt%.2ftt%.2fn",KEYBOARD,KEYBOARD_price,KEYBOARD*KEYBOARD_price);
total = (TV*TV_price)+(LAPTOP*LAPTOP_price)+(SPEAKER*SPEAKER_price)+(MOUSE*MOUSE_price)+(KEYBOARD*KEYBOARD_price);
tax = (total/100)*8.25;
fprintf("ttttt———-n");
fprintf("tttSUBTOTALt%.2fn",total);
fprintf("tttTAXEStt%.2fn",tax)
fprintf("tttTOTALtt%.2fn",total+tax); align values MATLAB Answers — New Questions