Last question was no help as I kept getting errors. Can someone please use visua
ID: 3805998 • Letter: L
Question
Last question was no help as I kept getting errors. Can someone please use visual basic to write this code and explain what i must do or look at the last question and see what he did wrong idk.
Here is the problem:
Here is just a photo of the program I am using so noone is confused. Please use this its visual basic for microsoft
Sales Report Brewster's Used Cars, Inc. employs several salespeople. K Brewster, the owner of the company, has provided a file that contains sales records for each salesperson for the past month. Each record in the file contains the following two fields: The salesperson's ID number, as an integer The amount of a sale, as a real number Files The records are already sorted by salesperson ID. Brewster wants you to design a program that prints a sales report. The report should show each salesperson's sales and the total sales for that salesperson. The report should also show the total sales for all salespeople for the month. Here is an example of how the sales report should appear: Brewster's Used Cars, Inc. Sales Report Salesperson ID Sale Amount 100 $10,000.00 100 $12,000.00 100 $5,000.00 Total sales for this salesperson: $27,000.00 101 $14,000.00 101 $18,000.00 101 $12,500.00 Total sales for this salesperson: $44,500.00 102 $13,500.00 102 $14,500.00 102 $20,000.00 Total sales for this salesperson: $48,000.00 Total of all sales: $119,500.00Explanation / Answer
Module m1
dim i,x as integer
dim totsales=0.000 as double
Structure sales[30] 'sales record
dim sales_id as integer
dim sales_amount as double
End Structure
sub main()
dim sales1 as sales
Console.WriteLine("Brewester Used cars, Inc");
Console.ReadKey()
Consloe.WriteLine("Sales Report")
Console.ReadKey()
for x= 1 to 30
sales1.sales_id=Int(Console.ReadLine())
sales1.sales_amount=Double(Console.ReadLine())
next
Console.WriteLine("SalesmanId SalesmanAmount")
Console.ReadKLey()
for i=1 to 30
if(sales1[i].sales_id=100) then
Console.Writeline("the Sales id {0} sales amount{1}",sales1[i].salesId,sales[i].amount)
totsales+=sales[i].amount
Console.Writeline("totalsales {0}:",totsales)
end if
if(sales1[i].sales_id=101) then
Console.Writeline("the Sales id {0} sales amount{1}",sales1[i].salesId,sales[i].amount)
totsales+=sales[i].amount
Console.Writeline("totalsales {0}:",totsales)
end if
if(sales1[i].sales_id=102) then
Console.Writeline("the Sales id {0} sales amount{1}",sales1[i].salesId,sales[i].amount)
totsales+=sales[i].amount
Console.WriteLine("totalsales {0}:",totsales)
End if
next
end sub
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.