Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
DASC	1204	–	Programming	Project	5	
Due	Date	–	03/14/2022		
1.	Problem	Statement:		The	primary	goal	of	this	programming	assignment	is	to	give	students	experience	with	arrays,	functions	and	fundamental	data	processing	techniques.	In	particular,	we	will	be	focusing	on	techniques	smoothing	or	enhancing	one-dimensional	time	series	data	such	as	digital	audio,	daily	temperatures,	or	stock	prices.		
		In	the	chart	above	we	can	see	the	value	of	the	Dow	Jones	stock	index	for	the	last	year.	The	blue	curve	shows	the	closing	price	every	day,	and	the	red	curve	shows	the	11	day	average	of	the	closing	price.	The	reason	we	show	the	11-day	average	is	because	it	smooths	out	the	high	variations	in	daily	data	which	makes	it	easier	to	identify	long	term	trends	and	make	predictions.		In	this	project,	your	first	task	will	be	to	implement	the	following	five	Java	functions.	Each	function	will	take	in	a	one-dimensional	array	as	input	and	will	be	returning	an	output	array.	Functions	may	also	have	one	or	more	“control	parameters”	that	specify	how	the	function	operates.			
• double	[]	Average(double	input[],	int	N)	–	This	function	will	calculate	the	“moving	average”	of	the	previous	N	samples	in	the	input	array	to	produce	the	output	array.	For	example	if	N=3,	then	output[i]	=	(input[i-1]	+	input[i-2]	+	input[i-3])/3.	There	are	two	common	approaches	to	deal	with	potential	array	bounds	issues	near	the	start	and	end	of	the	array.	One	method	is	to	reduce	the	number	of	points	in	the	calculation.	For	example,	output[2]	=	(input[1]	+	input[0])/2.	Another	method	is	to	“clamp”	the	array	indices,	so	any	attempt	to	access	negative	index	uses	the	value	in	location	0	instead.	For	example,	output[2]	=	(input[1]	+	input[0]	+	input[0])/3.		
• double	[]	Median(double	input[],	int	N)	–	This	function	will	calculate	the	“moving	median”	of	N	samples	in	the	input	array	to	produce	the	output	array.	The	median	should	be	based	on	the	previous	N	samples	in	the	array.	For	example	if	N=3,	then	output[i]	=	median(input[i-1],	input[i-2],	input[i-3]).	To	implement	the	median	calculation,	you	will	need	to	copy	N	values	into	a	temporary	array,	sort	the	array	and	select	the	midpoint	of	this	array	as	the	median.	You	are	welcome	to	use	code	for	calculating	the	median	from	the	programming	lab	if	you	wish.		
• double	[]	Predict(double	input[],	int	N)	–	This	function	will	calculate	“moving	predictions”	of	the	previous	N	values	in	the	input	array	to	produce	the	output	array.	Program	traders	have	invented	dozens	of	ways	to	do	this	to	decide	when	they	should	buy	or	sell	stocks.	For	this	project,	we	will	be	using	a	simple	line	fitting	approach	based	on	the	previous	N	samples	in	the	input	array.	The	tricky	part	of	this	process	is	deciding	how	to	define	your	line	equation.	For	example,	one	approach	is	to	fit	a	line	through	input[i-1]	and	input[i-N]	and	use	this	to	predict	the	value	of	input[i].	The	problem	is	that	data	values	might	be	noisy,	so	your	estimate	could	be	inaccurate.	To	fix	this,	you	could	smooth	the	input	data	before	making	linear	predictions.	
• double	[]	Difference(double	input1[],	double	input2[])	–	This	function	will	calculate	the	element-by-element	“difference”	between	the	two	input	arrays	to	produce	the	output	array.	If	you	use	this	function	to	compare	your	input	data	to	your	predicted	data,	you	can	see	how	much	money	you	would	make	(or	lose)	as	a	program	trader.		
• void	Print(double	input1[])	–	This	function	should	loop	over	the	input	array	and	print	the	values	to	the	screen	in	a	way	that	can	be	easily	input	to	a	spreadsheet	for	display	purposes.		Your	second	task	will	be	to	write	a	main	program	that	allows	users	to	call	these	functions	to	process	some	typical	one-dimensional	data	to	demonstrate	what	each	of	these	function	outputs.	To	start,	you	should	“hard	code”	a	sequence	of	calls	to	test	that	they	all	work	properly	on	a	small	input	array.	Once	this	is	working,	you	can	adapt	this	program	so	the	user	can	select	which	functions	to	call	and	control	various	input	parameters	(e.g.	the	size	of	smoothing	window)	to	process	larger	input	arrays.	Save	your	program	output	to	be	included	in	your	project	report.		
2.	Design:	
	This	programming	project	does	not	have	a	very	large	design	component.	You	are	asked	to	implement	five	functions	with	pre-defined	parameters	and	return	types.	Your	main	task	is	to	work	out	the	formulas	and	algorithms	needed	to	perform	the	specified	tasks.	The	hardest	function	is	the	Predict	function,	so	you	may	want	to	save	that	one	for	last.		Once	all	of	your	functions	are	working	properly,	your	task	is	to	design	a	simple	user	interface	that	will	allow	the	user	to	select	what	smoothing	or	prediction	function	to	call	and	what	parameters	to	use.	This	is	not	a	“user	interface”	project,	so	can	keep	this	part	short	and	simple.	For	example,	you	could	give	the	user	three	options,	a=average,	m=median,	p=predict,	and	based	on	their	selection	you	can	call	the	corresponding	function	on	the	input	data.	
	
3.	Implementation:		You	are	starting	this	programming	project	with	our	sample	program	“Signal.java”,	so	you	already	have	something	that	compiles	and	runs.	Your	task	is	to	add	several	features	to	this	program.	It	is	very	important	to	make	these	changes	incrementally	one	feature	at	a	time,	writing	comments,	adding	code,	compiling,	and	debugging.	This	way,	you	always	have	a	program	that	"does	something"	even	if	it	is	not	complete.	
	
4.	Testing:		You	should	test	your	program	with	a	range	of	user	inputs	to	demonstrate	that	your	program	is	working	correctly.	Since	we	are	using	a	random	number	generator	to	create	your	input	signal	you	will	not	get	exactly	the	same	program	outputs	if	you	repeat	the	same	user	inputs.	Save	several	samples	of	your	program	input/output	to	include	in	your	project	report.		
5.	Documentation:		When	you	have	completed	your	program,	write	a	short	report	using	the	“Programming	Project	Report	Template”	describing	what	the	objectives	were,	what	you	did,	and	the	status	of	the	program.	Does	it	work	properly	for	all	test	cases?	Are	there	any	known	problems?	Save	this	project	report	in	a	separate	document	to	be	submitted	electronically.		
6.	Project	Submission:		In	this	class,	we	will	be	using	electronic	project	submission	to	make	sure	that	all	students	hand	their	programming	projects	and	labs	on	time,	and	to	perform	automatic	plagiarism	analysis	of	all	programs	that	are	submitted.		
	When	you	have	completed	the	tasks	above	go	to	Blackboard	to	upload	your	documentation	as	a	docx	or	pdf	file,	and	your	Java	program	file.			The	dates	on	your	electronic	submission	will	be	used	to	verify	that	you	met	the	due	date	above.	All	late	projects	will	receive	reduced	credit:		 10%	off	if	less	than	1	day	late,	20%	off	if	less	than	2	days	late,	30%	off	if	less	than	3	days	late,	no	credit	if	more	than	3	days	late.			You	will	receive	partial	credit	for	all	programs	that	compile	even	if	they	do	not	meet	all	program	requirements,	so	handing	projects	in	on	time	is	highly	recommended.		
7.	Academic	Honesty	Statement:		Students	are	expected	to	submit	their	own	work	on	all	programming	projects,	unless	group	projects	have	been	explicitly	assigned.	Students	are	NOT	allowed	to	distribute	code	to	each	other,	or	copy	code	from	another	individual	or	website.	Students	ARE	allowed	to	use	any	materials	on	the	class	website,	or	in	the	textbook,	or	ask	the	instructor	and/or	GTAs	for	assistance.		This	course	will	be	using	highly	effective	program	comparison	software	to	calculate	the	similarity	of	all	programs	to	each	other,	and	to	homework	assignments	from	previous	semesters.	Please	do	not	be	tempted	to	plagiarize	from	another	student.		Violations	of	the	policies	above	will	be	reported	to	the	Provost's	office	and	may	result	in	a	ZERO	on	the	programming	project,	an	F	in	the	class,	or	suspension	from	the	university,	depending	on	the	severity	of	the	violation	and	any	history	of	prior	violations.