Question

In: Computer Science

PROGRAM DEVELOPMENT: Analyze and write the code for the following requirement: The sales department wants to...

PROGRAM DEVELOPMENT: Analyze and write the code for the following requirement:
The sales department wants to store the sales data of their employees. Assume that there are 20 employeesand they all work in three areas. Declare appropriately and accept the sales data from the user.

Solutions

Expert Solution

import java.io.FileOutputStream;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;


public class Spreadsheet {

public Spreadsheet() {
Workbook SalesInfo = new HSSFWorkbook();
Sheet Information = SalesInfo.createSheet();

Row titles = Information.createRow(0);

Cell empid = titles.createCell(0);
id.setCellValue("empid");

   Cell empname = titles.createCell(1);
empname.setCellValue("Name");

   Cell email = titles.createCell(2);
email.setCellValue("Email");

   Cell Area = titles.createCell(3);
Area.setCellValue("Area");

Cell salesfig = titles.createCell(4);
salesfig.setCellValue("Sales Figure");


try {
FileOutputStream Accounts = new FileOutputStream("Sales Information.xls");
AccountInfo.write(Accounts);
}catch(Exception e){
e.printStackTrace();
}
}
}

--------------------

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.border.Border;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

public class CreateAccount extends JFrame implements ActionListener {

Workbook SalesInfo = new HSSFWorkbook();
Sheet Information = SalesInfo.createSheet();

JLabel empid = new JLabel("Enter Employee ID");
JTextField empid = new JTextField(null, 15);

JLabel empname = new JLabel("Enter Employee Name");
JTextField empname = new JTextField(null, 15);
  
JLabel email = new JLabel("Enter Employee Email");
JTextField email = new JTextField(null, 15);

JLabel Area = new JLabel("Enter Sales Area");
JTextField Area = new JTextField(null, 15);

JLabel salesfig = new JLabel("Enter Employee Salesfig");
JTextField salesfig= new JTextField(null, 15);

JButton okButton = new JButton("OK");

String id;
String name;
String emailaddress;
String salesarea;
String salesnumber;

public CreateAccount() {

add(id);
add(name);
add(emailaddresss);
add(salesarea);
add(salesnumber);
add(okButton);

okButton.addActionListener(this);

setTitle("New sales record Creation");
setVisible(true);
setLocationRelativeTo(null);
setSize(270, 250);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(new FlowLayout());

}


private void addAccount(String username, String password) throws IOException {

FileInputStream file = new FileInputStream(new File("SalesInfo Information.xls"));   
HSSFWorkbook workbook = new HSSFWorkbook(file);
HSSFSheet sheet = workbook.getSheetAt(0);

int newRowIndex = sheet.getPhysicalNumberOfRows(); //index of new row to create
HSSFRow newRow = sheet.getRow(newRowIndex);

HSSFCell id1 = newRow.createCell(0);
id1.setCellValue(id);

HSSFCell name1 = newRow.createCell(0);
name1.setCellValue(name);

   HSSFCell emailaddresss1 = newRow.createCell(0);
emailaddresss1.setCellValue(emailaddresss);

   HSSFCell salesarea1 = newRow.createCell(0);
salesarea1.setCellValue(salesarea);
  
   HSSFCell salesnumber1 = newRow.createCell(0);
salesnumber1.setCellValue(salesnumber);

}
}


Related Solutions

Write a c++ program for the Sales Department to keep track of the monthly sales of...
Write a c++ program for the Sales Department to keep track of the monthly sales of its salespersons. The program shall perform the following tasks: Create a base class “Employees” with a protected variable “phone_no” Create a derived class “Sales” from the base class “Employees” with two public variables “emp_no” and “emp_name” Create a second level of derived class “Salesperson” from the derived class “Sales” with two public variables “location” and “monthly_sales” Create a function “employee_details” under the class “Salesperson”...
Program this in C thank you PROBLEM DESCRIPTION: Write a program to implement the following requirement:...
Program this in C thank you PROBLEM DESCRIPTION: Write a program to implement the following requirement: The program will read from standard input two things - a string str1 on the first line of stdin (this string may be an empty string) - a string str2 on the second line of stdin (this string may be an empty string) Note that stdin does not end with '\n'. The program will output a string that is the concatenation of string str1...
Analyze the following Verilog code and write down its output as pictured in the code. module...
Analyze the following Verilog code and write down its output as pictured in the code. module blocking; reg [0:7] A, B; initial begin: init1 A = last decimal digit of your ID; #1 A = A + 1; // blocking procedural assignment B = A + 1; $display("Output 1: A= %b B= %b", A, B ); A = last decimal digit of your ID; #1 A <= A + 1; B <= A + 1; #1 $display ("Output 2: A=...
Need C++ code for following with a document describing the code as well: Write a program...
Need C++ code for following with a document describing the code as well: Write a program to implement the game of Tic Tac Toe Four. The game is played on a 4 × 4 chessboard, within 2 players. The player who is playing "X" always goes first. Players alternate placing Xs and Os on the board until either one player has four in a row, horizontally, vertically, or diagonally; or all 16 squares are filled(which is a draw). The program...
A professor wants to determine whether her department should keep the requirement of college algebra as...
A professor wants to determine whether her department should keep the requirement of college algebra as a prerequisite for an Introductory Statistics course. Accordingly, she allows some students to register for the course on a pass-fail basis regardless of whether or not they have had the prerequisite. At the end of the semester, the professor compares the number of students passing or failing the class with whether or not they had algebra. Of the 70 students in the class, 30...
Please write in Python code Write a program that stores the following data in a tuple:...
Please write in Python code Write a program that stores the following data in a tuple: 54,76,32,14,29,12,64,97,50,86,43,12 The program needs to display a menu to the user, with the following 4 options: 1 – Display minimum 2 – Display maximum 3 – Display total 4 – Display average 5 – Quit Make your program loop back to this menu until the user chooses option 5. Write code for all 4 other menu choices
Write a program for hotel booking system using C++ Program Requirement 1. You can write any...
Write a program for hotel booking system using C++ Program Requirement 1. You can write any program based on the title assigned. 2. The program must fulfill ALL the requirements below. The requirements listed below are the MINIMUM requirement. Your program may extend beyond the requirements if needed. a) Create at least one (1) base class. b) Create at least two (2) derived classes that inherit from the base class created in 2(a). c) Create at least one (1) object...
B. Manually analyze and debug the following logic and programming code. Write in the result column,...
B. Manually analyze and debug the following logic and programming code. Write in the result column, the value of the result variable when the variables i and j have the values ​​indicated in each row of the table (6 pts.). In the event that the result cannot be calculated, state it and the reason. Option Explicit Sub Calc () Dim i As Integer, j As Integer, n As Integer Dim result As Integer i = 0 j = 0 n...
write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
Java please! Write the code in Exercise.java to meet the following problem statement: Write a program...
Java please! Write the code in Exercise.java to meet the following problem statement: Write a program that will print the number of words, characters, and letters read as input. It is guaranteed that each input will consist of at least one line, and the program should stop reading input when either the end of the file is reached or a blank line of input is provided. Words are assumed to be any non-empty blocks of text separated by spaces, and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT