Question

Create a Wpf application Use Visual Studios 2019 A shipping company receives packages at its headquarters,...

Create a Wpf application

Use Visual Studios 2019

A shipping company receives packages at its headquarters, which functions as its shipping hub. After receiving the packages the company ships them to a distribution center in one of the following states: Alabama, Florida, Georgia, Kentucky, Mississippi, North Carolina, South Carolina, Tennessee, West Virginia or Virginia. The company needs an application to track the packages that pass through its shipping hub. The application generates a package ID number for each package that arrives at the shipping hub, when the user clicks the application’s Scan New Button. Once a package has been scanned, the user should be able to enter the shipping address for the package. The user should be able to navigate through the list of scanned packages by using Buttons and by viewing a list of all packages destined for a particular state.

This Application is expected to work as described below:

  1. Scanning a new package:
    1. Click the “Scan New” button. The application displays a package ID number, the current date and time in “Arrived at:” textbox, enables the TextBoxes and allows the user to enter the package information (address)
    2. Adding a package to the list of packages: Click in the “Address” TextBox to transfer the focus of the application to that field, and enter data. Continue using Tab to transfer focus to each field and finish address entry (City, select state using ComboBox, etc.). Then click the “Add” button to add the package to the application’s ArrayList or List<>.
  2. Removing, editing, and browsing packages: The application’s NEXT > and
  3. Viewing all packages going to a state: The ComboBox on the right side of the application allows the user to select a state. When a state is selected, all of the package ID numbers of packages destined for that state are displayed in the ListBox (below the state comboBox at the right hand side of the Figure)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

<Window x:Class="ShippingApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30*"/>
<RowDefinition Height="289*"/>
</Grid.RowDefinitions>
<Button x:Name="scanButton" Content="Scan new" HorizontalAlignment="Left" Margin="82,203.908,0,0" VerticalAlignment="Top" Width="75" Click="scanButton_Click" Grid.Row="1"/>
<TextBox x:Name="tb1" HorizontalAlignment="Left" Height="23" Margin="157,59.908,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="213" Grid.Row="1"/>
<Label Content="Arrived at" HorizontalAlignment="Left" Margin="43,55.908,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.56,-0.14" Grid.Row="1"/>
<Label Content="Address" HorizontalAlignment="Left" Margin="43,133.908,0,0" VerticalAlignment="Top" Grid.Row="1"/>
<TextBox x:Name="tb2" HorizontalAlignment="Left" Height="23" Margin="157,133.908,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Grid.Row="1"/>
<Button x:Name="scanButton_Copy" Content="Back" HorizontalAlignment="Left" Margin="219,203.908,0,0" VerticalAlignment="Top" Width="75" Grid.Row="1" Click="scanButton_Copy_Click"/>
<Button x:Name="scanButton_Copy1" Content="Next" HorizontalAlignment="Left" Margin="377,203.908,0,0" VerticalAlignment="Top" Width="75" Grid.Row="1" Click="scanButton_Copy1_Click"/>
<Label Content="ID" HorizontalAlignment="Left" Margin="52,6.908,0,0" VerticalAlignment="Top" Grid.Row="1"/>
<TextBox x:Name="tb2_Copy" HorizontalAlignment="Left" Height="23" Margin="157,6.908,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Grid.Row="1"/>

</Grid>
</Window>

Code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ShippingApplication
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
List<Package> list = new List<Package>();

private void scanButton_Click(object sender, RoutedEventArgs e)
{
Random random = new Random();
int num = random.Next(1000);
tb1.Text = DateTime.Now.ToString();
tb2_Copy.Text = Convert.ToString(num);

Package obj = new Package();
obj.id = Convert.ToInt32(tb2_Copy.Text);
obj.address = tb2.Text;

list.Add(obj);
}

private void scanButton_Copy_Click(object sender, RoutedEventArgs e)
{
//Display the objects from the list accordingly

}

private void scanButton_Copy1_Click(object sender, RoutedEventArgs e)
{
//Display the objects from the list accordingly
}
}

class Package
{
public int id;
public string address;
}
}

Add a comment
Know the answer?
Add Answer to:
Create a Wpf application Use Visual Studios 2019 A shipping company receives packages at its headquarters,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lhe ABC Shipping Company charges the Rates listed in the following table: Weight of the package R...

    The ABC Shipping Company charges the Rates listed in the following table: Weight of the package            Rate per mile in California      Rate per mile other states 2 kg or less                                          $2.5                                                     $3.5 Over2 kg but not more than 6 kg        $3.5                                                     $5.0 Over 6 Kg but not more than 10 kg    $4.5                                                     $6.0 Over 10 Kg but not more than 30 Kg $5.0                                                     $7.5 Over 30 kg                                          $6.0                                                     $8.5 Create an application that contains two radio buttons to select California...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT